Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Concat() not working in the script

Hi all,

I have a small table with one column and about ten values that I want to concatenate into a single string in the script:

SQL SELECT DISTINCT item FROM table...;

LET itemString = Concat(item, ',');

However the resulting variable is empty (actually I do not even see it when looking at the variable editor).

When I define the variable in the variable editor (as = Concat(item, ',')), it works fine and I get a concatenated list of all values in the table.

Why is it not working in the script? Is there any other way to achieve this?

Thanks in advance.

Regards,

Robert

5 Replies
ariel_klien
Specialist
Specialist

Hi

Try

LET itemString = Concat(peek(ITEM), ',');

BR

Ariel

Not applicable
Author

Simply use '&' symbol for concat.

Karthik

kumarnatarajan
Partner - Specialist
Partner - Specialist

Hi,

See below script it's very helpful for you

Ex:

Temp:

LOAD Concat(item,',') as ConcatItem;

LOAD * INLINE [

    item

    1

    2

    3

    4

    5

];

LET vitemString=Peek('ConcatItem',0,'Temp');

For your Script see below syntax:

Ex2:

Temp:

LOAD Concat(item,',') as item;

SQL SELECT DISTINCT item FROM table...;

LET itemString = Peek('item',0,'Temp');

Not applicable
Author

TEMP:

LOAD

ITEM

FROM TABLE;

LOAD

Concat(ITEM,',') as CONCAT;

RESIDENT TEMP;

Not applicable
Author

Hi,

Thanks, I found a similar solution in the mean time:

LOAD Concat(item, ',') AS ItemConcat;

SQL SELECT item from table...;

LET itemString = peek('ItemConcat');

Regards,

Robert