Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to concatenate fields and store into new variable?

I have 6 columns in a table called RPUNit namely;

pcinum

mdinum

binum

sinum

parcel

ptype

I need to fetch data for each fields and concatenate them and store into new variable called pin2.

I need to see something like this: pcinum-mdinum-binum-sinum-parcel-ptype (concatenate values then stored in pin2)

5 Replies
morganaaron
Specialist
Specialist

Hi Mark,

You want to concatenate every row of the table together? Or are you talking about trying to return a variable for every row? Are the fields all dimension fields in your table?

Anonymous
Not applicable
Author

do this in the same table at script level::

pcinum&'-'&mdinum&'-'&binum&'-'&sinum&'-'&parcel&'-'&ptype as [pcinum-mdinum-binum-sinum-parcel-ptype]

Anonymous
Not applicable
Author


You can store into variable but it will be 1 value at a time


pcinum&'-'&mdinum&'-'&binum&'-'&sinum&'-'&parcel&'-'&ptype as Pin2   //Pin2 is new field name

effinty2112
Master
Master

Hi Mark,

We need to be careful how we use the word concatenate in QlikView land. I guess what you mean is string concatenation e.g. "dog" & "cat" & "mouse" = "dogcatmouse".

In QlikView dashboard design the word can have that meaning but in scripting it's used mostly to refer to the Concatenate operation that combines two tables. If you're coming from a SQL background you'll maybe want to call this a Union.

If you are referring to string concatenation are you, to repeat Aaron's question, wanting to create a variable for each row?

Cheers

MarcoWedel

Hi,

if you just "need to see something like this", then you could calculate the concatenated value in a straight table like this:

QlikCommunity_Thread_193065_Pic1.JPG

QlikCommunity_Thread_193065_Pic2.JPG

hope this helps

regards

Marco