Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

to concat variable

Hi,

The &' '& is not working.

somebody help...... ?

Thanks,

for vVariableNo = 0 to NoOfRows('POLIST')

          Let vPO = $(vPO) &' '& FieldValue('PO',vVariableNo);

next vVariableNo

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

POLISTConcat:

Load Concat(Distinct PO,',') AS POConcat

Resident

POLIST;

is a new table by concatenating the all the PO field values with comma separator.

Did you checked it out how it works?

View solution in original post

8 Replies
MayilVahanan

Hi

try like this

Let vPO = 'test';

for vVariableNo = 0 to NoOfRows('POLIST')

           vPO = vPO &' '& FieldValue('PO',$(vVariableNo));

next vVariableNo

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi Mayil,

but i don't want test in my string.

I'm trying to put all the po number into variable by coma deliminator.

and i will use this to loop in my load script.

so i don't have to hardcode my PO number.

so. the result should be...

1234, 2345, 3454

MayilVahanan

Hi

Let vPO = '';

for vVariableNo = 0 to NoOfRows('POLIST')

           vPO = vPO &','& FieldValue('PO',$(vVariableNo));

next vVariableNo

vPO  = right(vPO,len(vPO)-2);

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
CELAMBARASAN
Partner - Champion
Partner - Champion

Try with this

POLISTConcat:

Load Concat(Distinct PO,',') AS POConcat

Resident

POLIST;

LET vPO = FieldValue('POConcat',1);

DROP Table POLISTConcat;

Not applicable
Author

Mayil,

Sorry, i didnt see you remove the dollor sign. so it works.

i do it like this though.

Let vPO = Text(FieldValue('PO', vVariableNo))  &','&  (vPO)

vPO cant be in front, it create some empty value. so i do it at the back.

Thanks

LET vPO = FieldValue('POConcat',1); will only give one value isnt it?

as i understood. the 1 represent the row?

CELAMBARASAN
Partner - Champion
Partner - Champion

POLISTConcat:

Load Concat(Distinct PO,',') AS POConcat

Resident

POLIST;

is a new table by concatenating the all the PO field values with comma separator.

Did you checked it out how it works?

MayilVahanan

HI

Fieldvalue(fieldname , n)

Returns the field value found in position n of the field fieldname (by load order). Fieldname must be given as a string value, e.g. the field name must be enclosed by single quotes. The first field value is returned for n=1. If n is larger than the number of field values, NULL is returned.

Yes,

FieldValue('POConcat',1); gives first value...

Use Celambarasan suggestion also, its easy know...

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Yes, i have problem with the loop, because at the end of the loop, i always get and empty value...

So i'm using the concat function.. i didn't know it works this way...

But thanks gentlemen for your help.