Make tMap remove a date 00/00/00

Five Stars

Make tMap remove a date 00/00/00

Hello


I have a csv file which have some time a date like this 00/00/00 by using tMap I want to make a condition if it 00/00/00 make it null 

I tried but its not work

 

ToMap.date_naissance  != "00/00/00" ? (ToMap.date_naissance).toString() : null 

 

Thank you

Fifteen Stars TRF
Fifteen Stars

Re: Make tMap remove a date 00/00/00

As input is a csv file, you should consider date_naissance field as a string. Change it in the corresponding schema and try this:

ToMap.date_naissance.equals("00/00/00") ? null : date_naissance

For France it should be dd/MM/yy.

Hope this helps,

TRF
Seven Stars

Re: Make tMap remove a date 00/00/00

Hi,

It works "ToMap.date_naissance.equals("00/00/00") ? null : date_naissance" Only when both the source and target data type is string.

What if our datatype in source is string and target is date data type.

Fifteen Stars TRF
Fifteen Stars

Re: Make tMap remove a date 00/00/00

As I suggest, you should have the date as a string as it comes from a csv file.
For the initial request, I don't think casting "00/00/00" is possible as it is not a valid date.
In other case, if one of the dates is a string you need to convert it for comparison:
TalendDate.parseDate("yy/MM/dd", row1.stringField)

Have look at this link for information about TalendDate routines.
https://help.talend.com/display/TalendOpenStudioforBigDataUserGuide520EN/10.5+TalendDate+Routines

TRF

2019 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now