Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
eruditio
Partner
Partner

QV not reading the correct field value due to similar values

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

1 Solution

Accepted Solutions
Not applicable

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

View solution in original post

8 Replies
Not applicable

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

eruditio
Partner
Partner
Author

I am testing as I write.

Thanks for the lead, I'll let you know in a second.

nilesh_gangurde
Partner
Partner

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

eruditio
Partner
Partner
Author

No no, I wanted to store them in separate variables (indexed).

Not applicable

Did the above worked? I tested and it is working.

QV_question.jpg

eruditio
Partner
Partner
Author

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

vamshi_1957
Creator II
Creator II

Try this

SET vf2 = Concat(f2, '|');

LET j = NoOfRows('T1');

FOR i = 1 to $(j)

LET vLines$(i) = subfield($(vf2), '|', $(i));

NEXT;

eruditio
Partner
Partner
Author

That's a smart routine.

I learned a lot today

Thanks to both of you


Antoine