When performing inner join in tMap,it is not fetching decimals

One Star

When performing inner join in tMap,it is not fetching decimals

I have tried using with float,double&Big Decimal datatypes still there is no result and it is showing only value for few rows and it ignores remaining.
Example Scenario:
I have two Input excel files: 1) contains item code,price,description etc..2) contains item cost,item code,quantity etc..
While doing inner join using tMap, the results are not as expected since only few item cost are being retrived and also rounding off the decimal points.
Expected Output:
Item code,cost,quantity,price,description

Thanks&Regards
-------------------
Lokanath
Moderator

Re: When performing inner join in tMap,it is not fetching decimals

Hi,
Did you set any data type conversion in tMap? Could you please elaborate your case with an example with input and expected output values?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Seventeen Stars

Re: When performing inner join in tMap,it is not fetching decimals

Using a decimal data type like float or double to identify a dataset is not a good idea. These data types are not exact as expected or needed. E.g. there os no exact zero!
If you have no other chance to join the data you have to round the values to a reasonable precision and then you can try to use them for joining. But there will be always a possible lack.
And last but not least, you have to take care all column pairs using in a join condition must have the same data type!
I would also take care the columns are not nullable.
Seventeen Stars

Re: When performing inner join in tMap,it is not fetching decimals

@jlolling +1 Smiley Happy
one option could be to multiply your decimal to compare 'entire number' :
12.36 x 100 = 1236 used to your join
my 2 cents
regards
laurent
Seventeen Stars

Re: When performing inner join in tMap,it is not fetching decimals

Yes this is always a good idea to use integer data types (int or long) e.g. for money values. It avoids a lot of very painful round caused problems. But please keep in mind a zero in double could mean: 0.0000000000000000001 ! Only moving the decimal delimiter digits more right is sometimes not enough, you have to be care the result is a integer and also the datatype.
Seventeen Stars

Re: When performing inner join in tMap,it is not fetching decimals

the only java type that "keep precision" is bigDecimal having a function to compare object between us.
You'll have to give scale for your number.
http://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html
hope it helps
regards
laurent
One Star

Re: When performing inner join in tMap,it is not fetching decimals

thank u so much for ur response now it is working fine when i tried with BigDecimal

thanks & regards
-------------------
Lokanath
Seventeen Stars

Re: When performing inner join in tMap,it is not fetching decimals

you're welcome Smiley Wink
regards
laurent