Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

How to let field value become name of variables?

I'm a newbie of qlikview.
I've encountered a variable assignment problem and would like to ask.

1. If i have a field name with 3 values, can i make the field value become the name of variable?

for example, if fieldvalue is 'sample1', 'sample2', 'sample3' , i would like them to become:

let sample1 = 1;

let sample2 = 2;

let sample3 = 3;

2. Moreover, i would like to assign field value into variables named from field value

let fieldvalue1 = otherfieldvalue;

let fieldvalue2 = otherfieldvalue;

let fieldvalue3 = otherfieldvalue;

Is there any method i can use in qlikeview?

ThanksSmiley Embarassed

Tags (2)
3 Replies
Not applicable

Re: How to let field value become name of variables?

try this

Let v1=1;

Let v2=2;

Let v3=3;

let sample1 = $(v1);

let sample2 = $(v2);

let sample3 = $(v3);

Not applicable

Re: How to let field value become name of variables?

Thanks for your response.

However, if each time i load the table and the number of field value are different,
how can i make variables generated and named dynamically with the table values?

For example, this time i have 3 field values, and the variables should be:

fieldvalue1 = otherfieldvalues;
fieldvalue2 = otherfieldvalues;

fieldvalue3 = otherfieldvalues;

next time the loaded table has 4 values , and the variables should be:
fieldvalue1 = otherfieldvalues;

fieldvalue2 = otherfieldvalues;

fieldvalue3 = otherfieldvalues;

fieldvalue4 = otherfieldvalues;

the loaded table may be different time by time, is there any automations or general form i can use?

Thanks

Not applicable

Re: How to let field value become name of variables?

Thanks.

I've read this before but it didn't tell me how to operate a variable name when it is set.

My think is how can i operate the vairable name when it is created?

Furthermore, I would like to use the field value to be the variable name or part of the variable name

For example, if  I have a table as below
FieldName            OtherFieldName

sale                      XXXX

cost                     YYYY

when i load the table into qlikview,
i would like do some automation or general form to convert all the field values of the table into qlikview variables.
Like sale = XXXX

       cost = YYYY

Thanks for your help

Community Browser