Date Scenario how can handle this

Eight Stars

Date Scenario how can handle this

hello everyone, 

how can i handle this type of date format,

i want to split it on 3 files like 

26 Dec 1955 ---> dd MMM yyyy -->||File 1

1944--> yyyy -->||File 2

Circa 1996 ---> file 3

 

the original data is same as  like this:- 

 

Date Of Birth

26 Dec 1955

26 Dec 1955

26 Dec 1955

26 Dec 1955

1944

1945

1955

Circa 1996

Circa 1996

Circa 1996

Circa 1996

Circa 1996


Accepted Solutions
Community Manager

Re: Date Scenario how can handle this

This means your data is null. You will have to handle nulls as well. Add something like....

row.Column!=null ? {your processing code} : {your response if the column is null}

View solution in original post


All Replies
Community Manager

Re: Date Scenario how can handle this

An easy way would be to use a tMap with 3 outputs (Circa_out, Year_out and Date_out). If the String value containing the date is 4 characters long, it must be the Date_out. If the String contains "Circa" it is the Circa_out. Otherwise it is the Date_out. You can use the output filters in the tMap to calculate this.

Eight Stars

Re: Date Scenario how can handle this

thanks sir, it works, but in "circa" filter is not working, 

what can i do in find "circa 1955" values? 

Community Manager

Re: Date Scenario how can handle this

You can use something like....

row.Column.toUpperCase().indexOf("CIRCA")>-1

.....to solve this

Eight Stars

Re: Date Scenario how can handle this

 

It's not working, gives some error "Exception in component tMap_2 (date_function2)
java.lang.NullPointerException" 

 

Community Manager

Re: Date Scenario how can handle this

This means your data is null. You will have to handle nulls as well. Add something like....

row.Column!=null ? {your processing code} : {your response if the column is null}

View solution in original post

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog