Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
__alebra__
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 

 

 

 

 

 

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