Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
lokanath1241
Contributor
Contributor

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
Labels (2)
7 Replies
Anonymous
Not applicable

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
Anonymous
Not applicable

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.
Anonymous
Not applicable

@jlolling +1 0683p000009MACn.png
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
Anonymous
Not applicable

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.
Anonymous
Not applicable

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
lokanath1241
Contributor
Contributor
Author

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

thanks & regards
-------------------
Lokanath
Anonymous
Not applicable

you're welcome 0683p000009MA9p.png
regards
laurent