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: 
ritvik4BI
Partner - Contributor III
Partner - Contributor III

Storing distinct records of a particular fieldname in a variable

Hi All,

I have a table which has a field called TagName. This particular field has several records. example alpha, beta and gamma they are repeating. i.e not distinct.  So I want a variable in the script editor storing all distinct records of TagName column.

 

final variable should look like this:

vTagName = 'alpha','beta','gamma'

Is this possible? If so HOW?

Thanks.

1 Solution

Accepted Solutions
PrashantSangle

Test:
Load * Inline[
ID
1
2
3
1
];

NoConcatenate
eval_distinct:
Load Concat(DISTINCT ID,',') as all_ID
Resident Test;

Let vAll_ID=peek('all_ID');

drop table eval_distinct;

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

3 Replies
PrashantSangle

Test:
Load * Inline[
ID
1
2
3
1
];

NoConcatenate
eval_distinct:
Load Concat(DISTINCT ID,',') as all_ID
Resident Test;

Let vAll_ID=peek('all_ID');

drop table eval_distinct;

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
rsaeedga
Contributor II
Contributor II

This one is giving values like 

alpha,beta,gamma 

I need them like below:

'alpha','beta','gamma'

PrashantSangle

Hi @rsaeedga ,

 

instead of just Concat(DISTINCT ID,',') use with chr(39)

try below code.

Test:
Load * Inline [
ID
1
2
3
1
];

NoConcatenate
eval_distinct:
Load chr(39)&Concat(DISTINCT ID,chr(39)&','&chr(39))&chr(39) as all_ID
Resident Test;

Let vAll_ID=peek('all_ID');

drop table eval_distinct;

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂