Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Everybody,
I tried to do a macro pressing x times a button (here x is a field selection in a table of values)
but when i use a non constant variable (here v) in the loop for it doesn't work for some reason :
sub Active
set v=ActiveDocument.Fields("NbValues").GetSelectedValues
if v.Count > 0 then
for i=1 to v
ActiveDocument.GetSheetObject("BU09").Press
for j=1 to 1000
next
next
end if
end Sub
Any idea how to solve this ?
ActiveDocument.Fields("NbValues").GetSelectedValues returns an Array so you would have to select an array item and get it's value. To get the value of the first item:
v.Item(0).Number
You may find it simpler to use the Evaluate function which allows you to use Qlik expressions.
for i=1 to ActiveDocument.Evaluate("=Min(NbValues)")
-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com
for i=1 to v.Count
-Rob
Hello Rob
I would like to stop the for loop when I reach the value in field "NbValues" not when I reach the Number of Selections in the ffield "NbValues" dont know if its clear
ActiveDocument.Fields("NbValues").GetSelectedValues returns an Array so you would have to select an array item and get it's value. To get the value of the first item:
v.Item(0).Number
You may find it simpler to use the Evaluate function which allows you to use Qlik expressions.
for i=1 to ActiveDocument.Evaluate("=Min(NbValues)")
-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com
It works thank you very much Rob
Sautations
Sofiane