Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Concatenate two fields

Good day,

I have a Customer field and a CustomerID field that I need to combine as one.

I believe the text should be:

  CustomerID&" "&Customer name as Customer_Name


Is this correct and where and how should I define this to create the new combined field?


Please help!

8 Replies
Not applicable
Author

this almost correct. correct in the case would be   CustomerID&' '&Customer name as Customer_Name


you implement in you script


example:


load

CustomerID&' '&Customer name as Customer_Name,

CustomerID,

[Customer name]

from source...

vinieme12
Champion III
Champion III

if you don't want to add a separator to distinguish then this is fine

Remember fieldname with spaces need to placed in square brackets

CustomerID&[Customer name] as Customer_Name


or


CustomerID&'-'&[Customer name] as Customer_Name (use a hyphen or _  underscore)


Cheers

V

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

I have first created an inline table and then on top of that using preceding load ! created [Customer Name]. If you are exporting value from some external data file, in the same stage you can write the code [Customer ID] & ' ' & Customer as [Customer Name] and create the new field.

I have created a qvw for you in the attachment.

LOAD *,

[Customer ID] & ' ' & Customer as [Customer Name];

LOAD * INLINE [

    Customer ID, Customer

    1, AB

    2, BC

    3, CD

    4, DE

    5, EF

];

Anonymous
Not applicable
Author

Hi,

Thank you for your quick response. I don't see the attachment though (or am I just being stupid?).

Regards

Anonymous
Not applicable
Author

I have attached again

avinashelite

I suggest to with

CustomerID&'-'&[Customer name] as Customer_Name


having space in the Key doesn't sounds good.

Chanty4u
MVP
MVP

try this

  CustomerID&"_"&[Customer name] as Customer_Name

engishfaque
Specialist III
Specialist III

Dear Martin,

Field Concatenation:

Use single quote instead of double quote and use brackets when you have a field name with space such as given below,

CustomerID & ' ' & [Customer name] as Customer_Name

Kind regards,

Ishfaque Ahmed