Discussion Board for collaboration on QlikView Scripting.
I have problems using a for loop and a for each expression in the same time.
My data looks something like this:
LOAD * INLINE[
Client DimID DimPos RowNo
A A1 1 1
A A2 2 2
A A3 3 3
B A1 1 4
B B1 2 5
B B3 3 6
C B1 1 7
C B2 2 8
C C1 3 9
I want to create variables of the DimID for each client to each DimPos
The result would look like this for DimPos:
I dont know how many clients there are (the point is that you can add or remove one or more clients).
I do know that it always going to be 8 dimensions for each client.
I've done this
FOR a=0 to 9
For Each Client in $(Clientlist)
Let Dim$(a)ID$(Client) = Peek('DimId',Peek('DimPos',$(a),'Temp'),'Temp');
...but it gives the wrong result..
Can someone help me out?
FOR each Client in $(Clientlist)
First close the inner loop and then outer loop
Sorry, my bad.. I've corrected it.
Thanks Mayil, but that will give a result of all 9 DimId on all clients.
I want to add 1 to $(a) at the same time the client changes.. When the loop is finished with the first client
after this the client switches, and at the same time I want the $(a) to restart with DimPos =1 then 2 then 3. (But the Peek function takes RowNo...)
Can I use the Step function after the for statement? Something like this:
For a=1 to 3 step 3
Can I use a i IF statement to get the right result?