I can’t display my value to two decimal places in a custom component, does anyone know how to achieve this? I should point out that it displays correctly elsewhere just not within a Custom Component so it’s either a little bug or I need to apply some Javascript or formatting to it in the Custom Component perhaps??
I’m multiplying two values together, a PRICE and an EXCHANGE RATE. For this example the price is 10.00 and the EXCHANGE RATE is 1.3285.
10.00 x 1.3285 = 13.285 and when rounded to 2 decimal places is 13.29. All fields are set to 2 dp.
If I display that same field in a standard table or in HTML it correctly displays it as 13.29 but if I display it in a custom component it display 13.285 (to 3 decimal places).
It I attempt to ROUND() that result in another number formula field it will just truncate that to 13.28 so regardless what I try I can’t get it to be consistent and display 13.29 in a Custom Component.
If I have a Number Formula (Basic Formula) field set to 2 decimal places and it is set to calculate 10.00 * 1.3285 and I have two records with the same value so something like this:
Record Value Rate Result
Record1 10.00 1.3285 13.29
Record2 10.00 1.3285 13.29
and then a parent connected record has a SUM (Complex Formula), also set to 2 decimal places that adds these two results together, what would you expect the SUM to equal ?
26.58
or
26.57?
I’m getting the later, 26.57 which surprised me but I guess this means that despite presenting the number to 2dp it’s actually summing the full number? Is there a method for just summing the 2DP part?
The SUM will calculate the actual value that’s in the Database, which is the full number. If you’d like to SUM the 2 decimal place number, you can use a rule to set a number field and then SUM that.
Hi @Chem thanks for the reply, I’ll look into setting up these rules as you advise, thanks for the clarity.
So when a number field is configured to be to x decimal places what we are actually saying, is set the display value to x decimal places and not the actual number.
That wasn’t obvious to me especially as I was setting that parameter in the Database Table and not on a display Page or PDF. It might be worth while adding a hint that this is actually what it’s doing, just a thought. Although if that’s obvious to everyone else and that’s how they would expect it to work that’s cool, it’s just me that found this confusing.