Skip to Content
2
Jun 28, 2020 at 05:49 AM

How to round a number with a data type float?

996 Views

Hello all,

I got a float type value of "Amount" field in database 8,124.12 and when display this value in UI5, I got the value of 8,124.11

This is my UI5 code:

<Input
value="{path: 'AMOUNT', type: 'sap.ui.model.type.Float', formatOptions: {maxFractionDigits: 2, roundingMode: 'AWAY_FROM_ZERO', parseAsString: true, style: 'standard'}}"
valueLiveUpdate="false" maxLength="50" name="AMOUNT"/>

Amount data type definition:

{name = "AMOUNT"; sqlType = DOUBLE; comment = "Amount";},

And the value from OData:

How can I get the correct value in UI5 as in database record (which is 8,124.12 and not 8,124.11) ?

Regards,

Ferry

Attachments

odata.png (1.5 kB)