Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Friends,
I am faced with a nasty bug, that I am unable to solve.
HEre is the scenario:
T1:
LOAD * INLINE [
f1, f2
A | , | 85 |
B | , | 1 |
C | , | 4 |
D | , | 2 |
E | , | 35 |
F | , | 11 |
G | , | 11 |
H | , | 4 |
I | , | 27 |
J | , | 5 |
K | , | 1 |
L | , | 5 |
M | , | 1 |
N | , | 1 |
]
;
Now I want to count the field values of each occurence and store in a variable to reuse later on.
LET j = NoOfRows('T1');
FOR i = 1 to $(j)
LET vLines$(i) = FieldValue('f2',$(i));
NEXT;
It is failing to assign values for similar fields.
Any thoughts on the matter?
Thanks,
Antoine
As Field will only hold distinct values, Include the concept of table to the above using Peek function.
LET vLines$(i) = peek('f2',$(i),'T1');
Change the counter to start from 0
As Field will only hold distinct values, Include the concept of table to the above using Peek function.
LET vLines$(i) = peek('f2',$(i),'T1');
Change the counter to start from 0
I am testing as I write.
Thanks for the lead, I'll let you know in a second.
Hi,
I think you wanted to store all the values of field in the perticular variable.
this is not possible. you can store only one value into variable at a time.
on the other hand if you wanted to reuse it, load another table in the for loop and create one more table.
hope this will help you.
-Nilesh
No no, I wanted to store them in separate variables (indexed).
Did the above worked? I tested and it is working.
I am running it inside the entire code, since I have a gut feeling that it will force QV to read at the line level.
A few more minutes my friend and I'll update the thread
Try this
SET vf2 = Concat(f2, '|');
LET j = NoOfRows('T1');
FOR i = 1 to $(j)
LET vLines$(i) = subfield($(vf2), '|', $(i));
NEXT;
That's a smart routine.
I learned a lot today
Thanks to both of you
Antoine