How to compare value of BigDecimal with a integer in tMap

One Star

How to compare value of BigDecimal with a integer in tMap

Hello,
Please teach me!
What i wanna do is following.
When creating comparison sentence in Expression Builder
for compare both values.
Then this error has occur and displayed massage like
it is different type of value that Bigdecimal and Integer.
comparison sentence i wrote is following.
/row1.amount != 0
row1.amount is Bigdecimal.
How can I compare these values?
Thanks!
Regards,
Six Stars

Re: How to compare value of BigDecimal with a integer in tMap

tak a look at java documentation.
One Star

Re: How to compare value of BigDecimal with a integer in tMap

Hi,
row1.amount!=new BigDecimal(0). But you should the syntaxe row1.amount.compareTo(new BigDecimal(0))? new BigDecimal(0) (it s equal) : (not equal)
One Star

Re: How to compare value of BigDecimal with a integer in tMap

Hi,
I don't know what you exactly want to do, but you can also write like below...
row1.amount != BigDecimal.valueOf(0)
So, if you use it in expression builder, you probably would like to make a logical comprasion. for that;
row1.amount != BigDecimal.valueOf(0) ? do x : do y
One Star

Re: How to compare value of BigDecimal with a integer in tMap

First convert BigDecimal tparam to integer in Expression Builder.
For Example : row1.ID.intValue() >= 2? "Y" : "N";

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

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

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download