Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Talendians,
I am trying to convert a string type to date type for a column. The source date is 2018-12-04 for example. The target date type is "EEE MMM dd hh:mm:ss:zzz yyyy".
I tried using the following function in my tmap.
row4.account_product_termination_date!=null && row4.account_product_termination_date!=" " ? TalendDate.parseDate("EEE MMM dd hh:mm:ss:zzz yyyy",row4.account_product_termination_date)
I see erroretail Message: Syntax error, insert ": Expression" to complete Expression
Can someone explain me what i am doing wrong?
Two things,
First, to compare strings in java use:
!row4.account_product_termination_date.equals(" ")
instead of !=
Also you need a true and false side to your statement, separated by a colon. So what to you want to happen if the row4.account_product_termination_date is null? Return null?
row4.account_product_termination_date!=null && !row4.account_product_termination_date.equals(" ") ? TalendDate.parseDate("EEE MMM dd hh:mm:ss:zzz yyyy",row4.account_product_termination_date) : null
Two things,
First, to compare strings in java use:
!row4.account_product_termination_date.equals(" ")
instead of !=
Also you need a true and false side to your statement, separated by a colon. So what to you want to happen if the row4.account_product_termination_date is null? Return null?
row4.account_product_termination_date!=null && !row4.account_product_termination_date.equals(" ") ? TalendDate.parseDate("EEE MMM dd hh:mm:ss:zzz yyyy",row4.account_product_termination_date) : null