Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
Partner
Partner

create a array- variable

Hi all, 

sorry if it could be a easy question, but I'm switching from Qlikview developer to Qliksense devoleper.

I'm tring to create in script Qliksense  an array as i did in qlikview:

 

nr = 1;

SET tab[$(nr)]= "val";  nr = $(nr) +1;       
SET tab[$(nr)]= "val2";  nr = $(nr) +1;
SET tab[$(nr)]= "val3";  nr = $(nr) +1; 

In View this code work perfectly but in sense i retreieve the following error: 

Unexpected token: '[1]', expected: '='

 

How  can i define an array in sense?

 

Thank

Alessio 

 

 

 

 

 

Tags (2)
1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: create a array- variable

That never created an array in Qlikview. It simply generated three separate variables.

You could as well leave out the square brackets. But if you insist you can do it this way:

nr = 1;

SET "tab[$(nr)]"= "val";  nr = $(nr) +1;       
SET "tab[$(nr)]"= "val2";  nr = $(nr) +1;
SET "tab[$(nr)]"= "val3";  nr = $(nr) +1; 

 


talk is cheap, supply exceeds demand
1 Reply
MVP & Luminary
MVP & Luminary

Re: create a array- variable

That never created an array in Qlikview. It simply generated three separate variables.

You could as well leave out the square brackets. But if you insist you can do it this way:

nr = 1;

SET "tab[$(nr)]"= "val";  nr = $(nr) +1;       
SET "tab[$(nr)]"= "val2";  nr = $(nr) +1;
SET "tab[$(nr)]"= "val3";  nr = $(nr) +1; 

 


talk is cheap, supply exceeds demand