Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
SMahadevan1608028474
Contributor
Contributor

Float Datatype

I have the source column as Product_Amount as Float Datatype (Eg: 23.6161)

I am expecting this should load only the 2 decimal values (Eg: 23.61).

In Var

******

(int)(Float.parseFloat(row4.Product_Amount)*100) - Datatype is Int

Here I need to cut off the amount and need to multiply by 100 to convert to integer.

In output table

****************

Float.parseFloat(String.valueOf(Var.var9))/100 - Type is Float

While running the program I got the error as attached.

Note: But the same logics is worked while convert from String to Double.

Labels (2)
4 Replies
SMahadevan1608028474
Contributor
Contributor
Author

Can anyone assist is there any issue in my logics?

 

Anonymous
Not applicable

Hello,

Did you try to add the precision part of your float column to 2? If your use case is trying to deal with a floating point error, using a BigDecimal instead of a float will better.0693p00000BVjIDAA1.png

SMahadevan1608028474
Contributor
Contributor
Author

I have tried with state but am getting the same error , even I have changed to Precision "2"

 

In Var

******

(int)(Float.parseFloat(row4.Product_Amount)*100) - Datatype is Int

In output table

****************

Float.parseFloat(String.valueOf(Var.var9))/100 - Type is Float and Precision as "2".

 

Even I have tried with BigDecimal as well.

 

SMahadevan1608028474
Contributor
Contributor
Author

Hi,

 

Is anyone can assist this issue.