Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i use this expression for select a specific cycle group in a macro
Set group = ActiveDocument.GetGroup("group")
group.Cycle 3
is ok, but i want to select my cycle with name not with the idorder, is possible?
i need that becouse if i select for id, never return the same cycle it depend from what cycle is selected in the moment
thanks
Thank you, but i see the fld.name always change the values. By the way i change the solution in this mode:
set group = ActiveDocument.GetGroup("GROUPNAME")
set gp = group.GetProperties
do while activedocument.evaluate("=GetCurrentField([GROUPNAME])") <> "NAME_FIELD"
group.Cycle 1
loop
I think the following features from the APIGuide.qvw will be useful to develop an appropriate matching-logic:
especially those one:
rem show fields of first group in document
groups = ActiveDocument.GetGroups
set gp = groups(0).GetProperties
set vars = gp.FieldDefs
for i = 0 to vars.Count-1
set fld = vars(i)
msgbox("field " & i+1 & " is " & fld.Name)
next
- Marcus
Thanks you but it is not a solution, not resolve
You need to build the solution yourself. With the above mentioned loop it's possible to read either the index and the name of the group-fields - means picking the wanted name from there returns the index and this could be used to switch between the cyclic-fields again. Just try not directly to toggle between the fields else use msgbox to return the names and indexes to see that your logic worked and apply it then to your final macro.
- Marcus
No sorry those is not the solution, becouse if i wrote:
set vars = gp.FieldDefs
for i = 0 to vars.Count-1
set fld = vars(i)
if fld.Name="GROUPELEMENT" then
msgbox("field " & i+1 & " is " & fld.Name)
group.Cycle i+1
end if
next
it not work, becouse the group.Cycle <number> is not the ID of the group element so if i put number 5 for example in group.Cycle, i will have not GROUPELEMENT but always different group element
Yes, just looked in the APIGuide and it's not the group-index else the number of cycling-steps:
- Marcus
Yes as i said.... so how can i solve the problem?
I think the difference between the index of the active field and your wanted field should deliver the number of cyclic-steps. The above mentioned loop returned the (static) index and there you could pick the index from your wanted field and with:
groups=ActiveDocument.GetGroups
set fld = groups(0).GetActiveField
you get the active field and you could again pick this index-value - and the difference should be your value (you may also consider a possible forward- and a backward-logic - means the calculation might be different if the index from the wanted field is higher or lower as from the active field).
- Marcus
Thank you, but i see the fld.name always change the values. By the way i change the solution in this mode:
set group = ActiveDocument.GetGroup("GROUPNAME")
set gp = group.GetProperties
do while activedocument.evaluate("=GetCurrentField([GROUPNAME])") <> "NAME_FIELD"
group.Cycle 1
loop