Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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
Not applicable

Re: to concat variable

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?

8 Replies
mayilvahanan
Not applicable

Re: to concat variable

Hi

try like this

Let vPO = 'test';

for vVariableNo = 0 to NoOfRows('POLIST')

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

next vVariableNo

Hope it helps

Not applicable

Re: to concat variable

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
Not applicable

Re: to concat variable

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

celambarasan
Not applicable

Re: to concat variable

Try with this

POLISTConcat:

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

Resident

POLIST;

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

DROP Table POLISTConcat;

Not applicable

Re: to concat variable

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
Not applicable

Re: to concat variable

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
Not applicable

Re: to concat variable

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...

Not applicable

Re: to concat variable

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.