Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
lescoulm
Contributor
Contributor

QlikView : Display value of variable with dynamic name

Hi,

I have a table with a column id : N_LOT :

1

2

3

...

For each record, I have created a variable vLot_x_Actif, where x=N_LOT :

vLot_1_Actif

vLot_2_Actif

vLot_3_Actif

...

Now, I want to display in a straight table the column N_LOT, the variable name and the variable value.

For the variable name :I put ='vLot_'&N_LOT&'_Actif' => OK, It works

For the varaible value , I put : =$('vLot_'& N_LOT &'_Actif') but a null value is displayed

Have you ideas for displaying values of these variables ?

8 Replies
sunny_talwar

How about this?

$(='vLot_'& N_LOT &'_Actif')

lescoulm
Contributor
Contributor
Author

It works, if I select one record

If I display all records, null value is diaplayed

sunny_talwar

Might have to use Pick(Match()) to get this to work. Exact syntax would have to be based on your dimension. Would you be able to provide a sample?

MarcoWedel

Hi,

instead of defining multiple variables maybe you could use

Dollar-sign expansion using parameters ‒ QlikView

Wouldn't help with the issue of only getting results with one selected record as dollar sign expansions are not evaluated per row of your chart.

hope this helps

regards

Marco

lescoulm
Contributor
Contributor
Author

Thank you for your proposal but It does not seem to work.

In the script, I have defined :

Set Get_Var_Value='$1&$2&$3';

in the straight table, I created the expression

=$(=$(Get_Var_Value('vLot_',N_LOT,'_Actif'))) => Does not work

If I put =$(=$(Get_Var_Value('vLot_',2,'_Actif'))) => Ok, work

My need is to dynamically build the variable name to get its value

lescoulm
Contributor
Contributor
Author

Here an example of script:

SET ThousandSep=' ';
SET DecimalSep=',';
SET MoneyThousandSep=' ';
SET MoneyDecimalSep=',';
SET MoneyFormat='# ##0,00 €;-# ##0,00 €';
SET TimeFormat='hh:mm:ss';
SET DateFormat='DD/MM/YYYY';
SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';
SET MonthNames='janv.;févr.;mars;avr.;mai;juin;juil.;août;sept.;oct.;nov.;déc.';
SET DayNames='lun.;mar.;mer.;jeu.;ven.;sam.;dim.';

TAB:
LOAD * INLINE [
N_LOT, Lot_Actif
1,0
2,0
3,1
4,1
5,0
];

Let vNb_Lots = NoOfRows('TAB');
For vI = 0 to (vNb_Lots - 1)
Let vNom_Variable = 'vLot_' & Peek('N_LOT',vI,'TAB') & '_Actif';
Let [$(vNom_Variable)] = Peek('Lot_Actif',vI,'TAB');

Next

MarcoWedel

Hi,

the idea was to check if you could just create one parameterized variable instead of your multiple ones, given this is possible with the expressions your variables contain.

Can you post a sample application to test with?

regards

Marco

lescoulm
Contributor
Contributor
Author

Here an example :