Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
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


2 Replies
swuehl
MVP
MVP

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

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