Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
skiruthigadevi
Partner - Creator
Partner - Creator

Regarding storing a field value in a variable

Hello Friends,

I appreciate your time. Is it possible to store a field value in a variable.

for eg:

I have selling_vendor and Flag as my fields.

load * inline [

selling_vendor, Flag

A,1,

B,0

];

I need to create a variable called vFlag that will have Flag value in it (either 0 or 1 based on selling vendor) 

 

Thanks a lot in advance.

Kiruthiga

2 Replies
vmoreno2605
Creator
Creator

Yes, you can store the value of a field in a variable, i have done this using loops in order to get every value of every row in the table, this is an example:

//First, i get the number of rows that my table has.

Let vNumberOfRows = NoOfRows('YourTable');

For x=0 to $(vNumberOfRows)-1
Let vFlag = Peek('YourField', $(x), 'YourTable');

//Here goes your code
NEXT //Here ends your loop

I hope this helps.
skiruthigadevi
Partner - Creator
Partner - Creator
Author

Thank you,

My report reduces by vendor based on section access, so I am loading all the vendors but if vendor A logins he will see only 

Vendor  ,Flag

A,0

So I am thinking of using peek function like

vFlag = Peek('Flag')

and there is only one Flag for a Vendor(either 0 or 1) so it should work, but need to test.

Any other suggestions ? any one??

Thanks,

Kiruthiga