Round to 2 decimal to string

0
We need to export a decimal value (based on a percentage calculation, for example 532.97475 as outcome). I need to export this value to SAP, but they will only accept 532.98 as a value. Is there a simple way to convert this decimal to a string or do I have to do a series of string manipulations? Edit: I probably did not formulate my question clearly. Isn't the correct way to round 532.97475 to 2 decimals 532.97 (and this is wat round($decimal,2) does). but SAP has a different way of rounding and wants 532.98. I think the solution is just to replicate this behaviour, but maybe there is another way to simply replicate this behaviour?
asked
3 answers
6

You can use formatDecimal.

answered
2

Did you check the Project Settings ?

There is a "Round numbers" option there nowadays...

answered
2

You can use the round() function with a precision, like round($Conversion/FromAmount *$Rate, 2) where in this case the precision is 2 decimal points. Wrapping that in toString() might give you what you want

answered