Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Everyone,
i'm trying to figure out, how to code a for loop in Qlikview that is iterating throught two variables at the same time (no nested for Loop)
I imagine the code to work like this:
for each vNumber,vLetter in ((1,2,3,4),(A,B,C,D))
trace$(vNumber);
trace$(vLetter);
Next;
Desired Output would be:
1
A
2
B
3
C
4
D
best regards,
smbeholl
Will you always have the same number of items in vNumber and vLetter? and how are they two linked together? the order of their listing?
I'll always have the same number of items in vNumber and vLetter. Not sure if i'm getting the second part of you question right, but like in my opening post, both variables should take the first value of their list first, then the second and so on.
thanks for your help!
@Vegar wrote:
You would need to create two loops to accomplish this. One per variable.
for each vNumber in 1,2,3,4
for each vLetter in 'A', 'B', 'C','D'
trace$(vNumber);
trace$(vLetter);
Next;
Next
This is a nested for loop and will give me the following output:
1
A
1
B
1
C
1
D
2
A
2
B
2
C
2
D
....
....
Thanks, this is definetly a good work around!