Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
__alebra__
Partner - Contributor II
Partner - Contributor II

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 

 

 

 

 

 

1 Solution

Accepted Solutions
Gysbert_Wassenaar

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

View solution in original post

1 Reply
Gysbert_Wassenaar

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