One Star

[resolved] Help needed to evaluate Boolean values in Input using tMap

Hi,
I am new to the Talend tool and currently engaged in a DataMigration project.
I have an input table with values in it. One of the columns is a BigDecimal field that contains Boolean Values (0 is FALSE, 1 is TRUE), however the column also contains NULL VALUES as no default is set. For my transformation, I am using tMap, and I wish to evaluate the value in this column as follows and based on the value, enter a String value to the column in my Output table:
For example:
---------------
If row1.TestInd = 0 then put "Not Submitted" into my Output Column
If row1.TestInd = 1 then put "Submitted" into my Output Column
If row1.TestInd = null then Do nothing
Hence I created the following Expression in tMap Expression builder but it does not work.
row1.TestInd==new BigDecimal(0)?"Not Submitted": row1.TestInd==new BigDecimal(1)?"Submitted":null
It simply sets everything to NULL in the output column when I run the job. Your help is greatly appreciated.
Regards,
Ibi
1 ACCEPTED SOLUTION

Accepted Solutions
One Star

Re: [resolved] Help needed to evaluate Boolean values in Input using tMap

row1.TestInd == null ? null :
row1.TestInd.compareTo(BigDecimal.ZERO) == 0 ? "Not Submitted" :
row1.TestInd.compareTo(BigDecimal.ONE) == 0 ? "Submitted" :
null
2 REPLIES
One Star

Re: [resolved] Help needed to evaluate Boolean values in Input using tMap

row1.TestInd == null ? null :
row1.TestInd.compareTo(BigDecimal.ZERO) == 0 ? "Not Submitted" :
row1.TestInd.compareTo(BigDecimal.ONE) == 0 ? "Submitted" :
null
One Star

Re: [resolved] Help needed to evaluate Boolean values in Input using tMap

Wow! Thank you so much. It worked perfectly just the way I wanted it. Appreciate your help.