Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a table in the editscript that is generated from the qvdfile. that table like(Test) Has 3 columns with 10 rows of data.I have loaded that table in to the qlikview. From the frontend i have created a group with those table columns.Right now this is good .But in future the data may increases for those table(like new columns may be added).But my group doesn't have the updated values.So,what my requirement is how to update the group automatically from the editscript.
Is it possible to update my group from the editscript....
Please share your valuable information with your replies to me and this is an urgent requirement.
Thanks in advance,,,,,
Hi Kaushik,
Thanks for your reply,
I am not able to open what you attached file in my system. Please can you send the button script in text format.
Thanks...
Hi Kaushik,
Thanks for your reply,
I am not able to open what you attached file in my system. Please can you send the button script in text format.
Thanks...
Hi,
Here is the script
sub add_Group
''groups=ActiveDocument.GetGroups
''groups(0).AddField "OrderID"
counter = 0
set LB = ActiveDocument.GetSheetObject("LB01")
boxvalues=LB.GetPossibleValues
for i = lbound(boxvalues) to ubound(boxvalues)
count = count + 1
next
if count = LB.GetRowCount then
msgbox "Please select one dimension"
Exit sub
else
'field = boxvalues(0)
for i = lbound(boxvalues) to ubound(boxvalues)
field = boxvalues(i)
call Add_grp(field)
next
end if
end sub
sub Add_grp(field)
set group = ActiveDocument.GetGroup("New Group")
set gp = group.GetProperties
set vars = gp.FieldDefs
for i = 0 to vars.Count-1
set fld = vars(i)
'msgbox("field " & i+1 & " is " & fld.Name)
if field = fld.name then
counter = 1
end if
next
if counter = 0 then
group.AddField field
msgbox field &" is Added to Group"
end if
end sub
''set group = ActiveDocument.GetGroup("New Group")
''set gp = group.GetProperties
''msgbox(gp.Present)
Regards,
Kaushik Solanki
Hi Kaushik,
Thanks a lot for sending the post and i got absolutely what i am looking for...
Thank you very much
Hi,
Can you Please mark this post as answered.
Thanks,
Kaushik Solanki
hi Kaushik,
Thanks for your reply,
Your code is working well.
i want another small task for that . That is how to remove the selected barchart field from the group, and this is to be done by using another button.
Please send the solution for that by text format.
Thanks....
Hi,
Here is your answer
sub add_Group
''groups=ActiveDocument.GetGroups
''groups(0).AddField "OrderID"
counter = 0
set LB = ActiveDocument.GetSheetObject("LB01")
boxvalues=LB.GetPossibleValues
for i = lbound(boxvalues) to ubound(boxvalues)
count = count + 1
next
if count = LB.GetRowCount then
msgbox "Please select one dimension"
Exit sub
else
'field = boxvalues(0)
for i = lbound(boxvalues) to ubound(boxvalues)
field = boxvalues(i)
call Add_grp(field)
next
end if
end sub
sub Remove_Group
''groups=ActiveDocument.GetGroups
''groups(0).AddField "OrderID"
counter = 0
set LB = ActiveDocument.GetSheetObject("LB01")
boxvalues=LB.GetPossibleValues
for i = lbound(boxvalues) to ubound(boxvalues)
count = count + 1
next
if count = LB.GetRowCount then
msgbox "Please select one dimension"
Exit sub
else
'field = boxvalues(0)
for i = lbound(boxvalues) to ubound(boxvalues)
field = boxvalues(i)
call Remove_grp(field)
next
end if
end sub
sub Add_grp(field)
set group = ActiveDocument.GetGroup("New Group")
set gp = group.GetProperties
set vars = gp.FieldDefs
for i = 0 to vars.Count-1
set fld = vars(i)
'msgbox("field " & i+1 & " is " & fld.Name)
if field = fld.name then
counter = 1
end if
next
if counter = 0 then
group.AddField field
msgbox field &" is Added to Group"
counter = 1
end if
end sub
''set group = ActiveDocument.GetGroup("New Group")
''set gp = group.GetProperties
''msgbox(gp.Present)
sub Remove_grp(field)
set group1 = ActiveDocument.GetGroup("New Group")
set gp = group1.GetProperties
set vars = gp.FieldDefs
for i = 0 to vars.Count-1
set fld = vars(i)
'msgbox("field " & i+1 & " is " & fld.Name)
if field = fld.name then
group1.RemoveField i
msgbox field &" is Removed From Group"
exit sub
else
counter1 = 0
end if
next
if counter1 =0 then
msgbox field & "is not in group"
counter1 =1
end if
end sub
Regards,
Kaushik Solanki
Hi Kaushik,
What you sent the code for removing the fields from the group is not working.
can you tell me how to remove the field from the group in a step by step procedure.
Thanks.
Hi,
Its working fine my side.
Can you tell me what happens, are you getting any errors
Regards,
Kaushik Solanki
Hi Kaushik,
First of all i really thank you for giving immediate response to us...
i am able to select the fields from listbox and when i click on the button, the fields are adding into the group.
But how can i remove the fields from group. Whether i need to click on the listbox and select a field and then i need to click on the button.
I had approached in two ways for removing the field from group.
1.) After adding all the fields in listbox to a Group, then i am again selecting the field from listbox and then i am clicking on the button, but it is not removing the fields and also not showing any errors.
2.)In the same way, my output is shown in barchart, that barchart contains group dimension. So when i click particular field from group in barchart and then again i clicked on the button. In this way also not removing the field and not showing any error.
Pls can you tell in process i need to remove the fields from group. And i had a question on this, Whether i need to add all the fields in listbox into group and after that only can i remove???
I am sure that you understand my problem.
Thnks