I am using QV 7.52 at this time but is it possible to copy cyclic groups to modify them with 7.52 or a later version?
function copygroup(x,y,z)
groups = ActiveDocument.GetGroups
set gp = groups(x).GetProperties
msgbox("The following group is copied: " &gp.Name)
for i=0 to y-1
Set gr = ActiveDocument.CreateGroup(gp.Name &i +z)
set vars = gp.FieldDefs
labls = gp.Labels
clc = gp.IsCyclic
for j = 0 to vars.Count-1
set fld = vars(j)
gr.AddField fld.Name
next
set ngr = ActiveDocument.GetGroup(gp.Name &i +z)
grp = ngr.GetProperties
grp.Labels = labls 'set labels
grp.IsCyclic = clc 'set if cyclic or not
ngr.SetProperties grp
msgbox("The resulting group is: " &grp.Name) 'shows the name of the newly created group
next
end function
sub SelectGroupCopy 'RUN THIS SUB TO COPY GROUPS (with labels and cyclic settings)
groups=ActiveDocument.GetGroups
for i=0 to 100
on error resume next
set gp = groups(i).GetProperties
if Err=0 then 'if there are no errors, continue to give the messagebox
group = msgbox(gp.Name & vbCrLf&vbCrLf&"YES - Copy this group"&vbCrLf&"NO - Next",3,"Group Selection")
end if
if group = 6 then 'msgbox YES
noofcopies = InputBox("Please enter how many copies you would like","Number of copies?","1")
if noofcopies = "" Then 'Canceled by the user or no input
msgbox("User input canceled, click OK to exit.")
exit sub
end if
whereinline = InputBox("Please enter the starting position of your copies."&vbCrLf&vbCrLf&"If you choose Dyn_Fin and write 4, the first copy would be Dyn_Fin4, the second Dyn_Fin5 and so on.","Starting position of copies?","1")
If whereinline = "" Then 'Canceled by the user or no input
msgbox("User input canceled, click OK to exit.")
exit sub
Else
call copygroup(i,noofcopies,whereinline)
exit sub
end if
end if
if group = 7 then 'msgbox NO
end if
if group = 2 then 'msgbox CANCEL
exit sub
end if
next
end sub
I really hope QlikTech integrates this functionality within the UI sometime soon, as they've finally done with expressions.
BR
Jakob
Hi
I'm using V8.5x and my answer would be "I WISH"
I have cyclic groups with over 50 members so it would be great if I could copy them, but I can't.
Not sure about v9 though.
Are you talking about moving the groups from one qvw to another,
if so I maintain a template qvw with the groups and common variables stored in it and I create all new views based on a copy of the template. I appreciate this doesnt help with modifying existing qvw's though
I want to create a copy in that application as well as transfer the cyclic group to another qvw. You're idea for transferring to another qvw is creative and I will utilize it in the future but my qvws already exist.
As Nigel stated, I have a cyclic group that contains about 50 members and I want to copy it. This would give the end user the opportunity to segment the data using multiple dimensions.
Thank you for your thoughts and responses.
Wondering if you ever found a solution to this problem. I'm trying to create a dynamic user definable table and need to copy my groups with expressions over multiple multiple times.
Many Thanks,
CL
The only "solution" I've found to this problem is to copy the groups using macro code. I do not understand why it is not avaliable as functionality similar to "copy expression" that can be used over multiple .qvws.
If you are interested in the macro solution, please drop me a line.
BR
Jakob
Hi,
can you post it here? From time to time have this requirement as well.
++
Peter
function copygroup(x,y,z)
groups = ActiveDocument.GetGroups
set gp = groups(x).GetProperties
msgbox("The following group is copied: " &gp.Name)
for i=0 to y-1
Set gr = ActiveDocument.CreateGroup(gp.Name &i +z)
set vars = gp.FieldDefs
labls = gp.Labels
clc = gp.IsCyclic
for j = 0 to vars.Count-1
set fld = vars(j)
gr.AddField fld.Name
next
set ngr = ActiveDocument.GetGroup(gp.Name &i +z)
grp = ngr.GetProperties
grp.Labels = labls 'set labels
grp.IsCyclic = clc 'set if cyclic or not
ngr.SetProperties grp
msgbox("The resulting group is: " &grp.Name) 'shows the name of the newly created group
next
end function
sub SelectGroupCopy 'RUN THIS SUB TO COPY GROUPS (with labels and cyclic settings)
groups=ActiveDocument.GetGroups
for i=0 to 100
on error resume next
set gp = groups(i).GetProperties
if Err=0 then 'if there are no errors, continue to give the messagebox
group = msgbox(gp.Name & vbCrLf&vbCrLf&"YES - Copy this group"&vbCrLf&"NO - Next",3,"Group Selection")
end if
if group = 6 then 'msgbox YES
noofcopies = InputBox("Please enter how many copies you would like","Number of copies?","1")
if noofcopies = "" Then 'Canceled by the user or no input
msgbox("User input canceled, click OK to exit.")
exit sub
end if
whereinline = InputBox("Please enter the starting position of your copies."&vbCrLf&vbCrLf&"If you choose Dyn_Fin and write 4, the first copy would be Dyn_Fin4, the second Dyn_Fin5 and so on.","Starting position of copies?","1")
If whereinline = "" Then 'Canceled by the user or no input
msgbox("User input canceled, click OK to exit.")
exit sub
Else
call copygroup(i,noofcopies,whereinline)
exit sub
end if
end if
if group = 7 then 'msgbox NO
end if
if group = 2 then 'msgbox CANCEL
exit sub
end if
next
end sub
I really hope QlikTech integrates this functionality within the UI sometime soon, as they've finally done with expressions.
BR
Jakob
Hi:
Using QV11, it is possible to export the document to xml code sheets. One of them is called AllProperties. Groups are described in that sheet. You can copy and paste into another doc's AllProperties sheet, and then read it. Let's see an example.
</FieldDefEx>
</FieldDefEx>
</FieldDefEx>
</FieldDefs>
</Labels>
</SortCriteria>
</SortCriteria>
</SortCriteria>
</SortCriterias>
</GroupProperties>
Thanks Jakob excellent !!!
Vikas