• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Column Assignment based on Content

#1 2012-06-04 05:03:37

stefanmueller
New member
Registered: 2012-06-04
Posts: 4

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)

Offline

#2 2012-06-04 07:52:13

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: Column Assignment based on Content

Hi Stefan

Welcome to Talend Community!

You might set expression in tMap as seen below.
Contact:

Code:

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

Company:

Code:

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

Regards,
Pedro


Only Paranoid Survive.

Offline

#3 2012-06-04 09:07:16

stefanmueller
New member
Registered: 2012-06-04
Posts: 4

Re: Column Assignment based on Content

Hi Pedro

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

Stefan

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Column Assignment based on Content

Board footer

Powered by FluxBB