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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Column Assignment based on Content

Hi,
I need to assign a column from an input table to 2 output columns based on the content.
Input Table: (extraction):
1. Salutation
2. Name
Output Table:
1. Salutation
2. Contact
3. Company
The data in the column "Name" (Input) is a mix of company names and private names. If I can find the words "Mr, Mrs, Ms", etc. in salutation I need to assign the content from "Name" (Input) to "Contact" (Output), otherwise it needs to go into "Company".
How can I do this in Talend?
Thank you very much!
Stefan
(Using Talend OS4DI 5.0.2)
Labels (2)
2 Replies
Anonymous
Not applicable
Author

Hi Stefan
Welcome to Talend Community!
You might set expression in tMap as seen below.
Contact:
row1.Name.startsWith("Mr")?row1.Name:(row1.Name.startsWith("Mrs")?row1.Name:(row1.Name.startsWith("Ms")?row1.Name:null))

Company:
row1.Name.startsWith("Mr")?null:(row1.Name.startsWith("Mrs")?null:(row1.Name.startsWith("Ms")?null:row1.Name))

Regards,
Pedro
Anonymous
Not applicable
Author

Hi Pedro
Great thanks for your answer!
It is a good and working solution.
Stefan