tag:blogger.com,1999:blog-3174073825360154810.post5372979381008531261..comments2022-12-06T05:49:47.306-05:00Comments on QlikView Maven: Step Through Field Values-TBhttp://www.blogger.com/profile/08386812862574514289noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-3174073825360154810.post-30416232889016345522009-07-22T02:14:38.814-04:002009-07-22T02:14:38.814-04:00Hi,
thnx for the reply.
I treid adding the Clear a...Hi,<br />thnx for the reply.<br />I treid adding the Clear and even Unlock methods, but still, it does not work:<br /><br />sub calculateAreasGoals<br /> dim a(5)<br /> Set val=ActiveDocument.Fields("Areas").GetPossibleValues<br /> 'ActiveDocument.ClearAll False<br /> For i=0 to val.Count-1<br /> ActiveDocument.Fields("Areas").Select val.Item(i).Text<br /> a(i) = loopBranches<br /> 'Activedocument.ClearAll<br /> next 'i<br /> set val=nothing<br /> Activedocument.Fields("Areas").Clear<br /> ActiveDocument.ClearAll False<br />end sub<br /><br />function getGoal()<br /> set val_1 = nothing<br /> Activedocument.Fields("NISGOAL").clear<br /> Set val_1=ActiveDocument.Fields("NISGOAL").GetPossibleValues<br /> ActiveDocument.Fields("NISGOAL").Select val_1.Item(0).Text<br /> Activedocument.Fields("NISGOAL").Unlock<br /> Activedocument.Fields("NISGOAL").Clear<br /> tmp = val_1.Item(0).Text<br /> set val_1 = nothing<br /> getGoal = tmp<br />end function<br />function loopBranches <br /> Set branch=ActiveDocument.Fields("BRANCHNAME").GetPossibleValues<br /> Accumulator=0<br /> for i = 0 to branch.Count-1<br /> set vals=nothing<br /> tmp = branch.Item(i).Text <br /> 'if ActiveDocument.Fields("BRANCHNAME").GetLocked then msgbox("LOCKED!!!")<br /> ActiveDocument.Fields("BRANCHNAME").Unlock<br /> ActiveDocument.Fields("BRANCHNAME").Clear<br /> 'if ActiveDocument.Fields("BRANCHNAME").GetLocked then msgbox("LOCKED!!!") <br /> ActiveDocument.Fields("BRANCHNAME").Select branch.Item(i).Text<br /> set vals=ActiveDocument.Fields("BRANCHNAME").GetSelectedValues<br /> Accumulator=Accumulator+getGoal<br /> ActiveDocument.Fields("BRANCHNAME").Clear<br /> next 'i<br /> set branch=nothing <br /> ActiveDocument.Fields("BRANCHNAME").Unlock<br /> ActiveDocument.Fields("BRANCHNAME").Clear <br /> loopBranches = Accumulator<br />end functionAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-3174073825360154810.post-10249825661438297532009-07-21T09:46:00.014-04:002009-07-21T09:46:00.014-04:00I think that you might have a BRANCHNAME value sel...I think that you might have a BRANCHNAME value selected as you go to the top of the loop. Remember that other field selections influence what values are considered <i>possible</i>.<br /><br />Try this statement after <i>Next k</i>:<br /><br /> Activedocument.Fields("BRANCHNAME").Clear-TBhttps://www.blogger.com/profile/08386812862574514289noreply@blogger.comtag:blogger.com,1999:blog-3174073825360154810.post-25640310783531501172009-07-21T03:17:30.901-04:002009-07-21T03:17:30.901-04:00Hi,
I am trying to step through several fields'...Hi,<br />I am trying to step through several fields' items and simply can not do so.<br />I have several areas, in each there are several branches, and I need to loop through all the numbers of the branches in each area. (The number is unique only per area).<br />I always get the branches of the first area, even after the loop through areas changed to a different area.<br />What am I doing wrong here?<br /><br />Set val=ActiveDocument.Fields("Areas").GetPossibleValues<br /> <br /> For i=0 to val.Count-1<br /> ActiveDocument.Fields("Areas").Select val.Item(i).Text<br /> ("Areas")<br /> Set branch=ActiveDocument.Fields("BRANCHNAME").GetPossibleValues<br /> <br /><br /> for k = 0 to branch.Count-1<br /> ActiveDocument.Fields("BRANCHNAME").Select branch.Item(k).Text<br /> 'actions next 'k<br /> set branch=nothing<br /> <br /> next 'i<br /> end subAnonymousnoreply@blogger.com