Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Variable declaration

Hello All,

I have one field which contains 100 unique value. I want to list down all fields value under one variable at script level. Below is the example;

Category

A,

B,

C,

D,

E,

F

Post achieving this, i will be using this variable in wildmatch or substringcount function at script level.

Could you please help me to achieve this?

Regards,

Imran K


Labels (1)
2 Replies
swuehl
Champion III
Champion III

Maybe like

TMP:

LOAD CONCAT(DISTINCT Category, ', ') as Tmp

RESIDENT YourTableWithCategory;

LET vCat = Peek('Tmp',0,'TMP');

or

TMP:

LOAD CHR(39) & CONCAT(DISTINCT Category, CHR(39)& ', ' & CHR(39) ) & CHR(39) as Tmp

RESIDENT YourTableWithCategory;

LET vCat = Peek('Tmp',0,'TMP');

then

DROP TABLE TMP;

marcus_sommer
MVP
MVP

You could use concat for this:

concat:

load concat(distinct Category, chr(39) & ',' & chr(39)) as CategoryList From xyz;

let vCategoyList = peek('CategoryList', 0, 'concat');

and then you could use '$(vCategoryList)' within your functions.

- Marcus