Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
gsethuraman2
Contributor III
Contributor III

How to make dynamic variable in qliksense

For example in below scenario if rowcount has 4 then i need 4 variables need to set ..Which will be dynamically need to set ..

For i=1 to $(RowCount)

set vPERSON_NAME1=$(vPERSON_NAME);

 

if i=2

then 

set vPERSON_NAME2=$(vPERSON_NAME);

 

how to set dynamic variable vPerson_NAME+i --> how to acheive this 

3 Replies
vmoreno2605
Creator
Creator

Hi! You can trick Qlik by using variables like this:

 

if(Field1 $(variable1) $(variable2),0,
if(Field1 $(variable3) $(variable4),0.5,1
)) as NewField

In this example:

variable1='<='

variable2='0'

variable3='<='

variable4='1'

Using variables like that u trick qlik sense, now lemme show you something that might help you, this is an example i did for your requierment

For x=0 to 3

let vintento$(x)=$(x);


NEXT

TRACE $(vintento0);
TRACE $(vintento1);
TRACE $(vintento2);
TRACE $(vintento3);

 

As you can see, i harcoded the variables name in order to see ther value, but here in this image you can see they really were created

Capture.PNG

Im sorry about my english, i hope this helps

Maxwell20
Contributor
Contributor

Thanks for the pics.It really helped a lot.Thank you so much mygiftcardsite

gsethuraman2
Contributor III
Contributor III
Author

Thanks it helped ..