formatDecimal on page does not allow second parameter to format the number with commas

0
I am using a microflow to do calculations on form data & database data (non-persistent and persistent). I display the results of each calculation on a page. Additionally, one of the results to be displayed is the sum of ALL the calculations done in the microflow. In the page view I can do this using an expression and formatDecimal(calcResult1 + calcResult2 + calcResult3) however it does not allow me to pass the second param (e.g. '#,###.#') which is the formatting of the decimal "invalid argument types (Decimal, String)..    The result is the number has no commas (e.g. 164321).   I can control the commas when using a attribute path as opposed to an expression in the page view (there's a setting for that which is absent when using an expression and unfortunately formatDecimal does not work with the formatting param). I do not want to repeat all the calculations again in the microflow to make the total as that would mean repeating the calculations twice in the microflow (so if i change one calculation in the microflow I would need to remember to also change it in the "total" calculation in the microflow).   Is there any way at the page level to control the commas in a decimal number?
asked
2 answers
1

You can't use formatting string parameter in an expression as it works like a Nanoflow. It will use the decimal format from your locale.

 

https://docs.mendix.com/refguide/parse-and-format-decimal-function-calls/

 

One solution could be to create a new attribute in your entity and set it in your microflow. Make it one of the last actions of the microflow, so it uses the values that have already been calculated and stored earlier. If it's using the calculated values, you won't need remember to also change it in the "total" calculation.

 

Good luck

answered
0

Many thanks Robert - I had thought of this too (using multiple additional items in the microflow - it works) but I had hoped there was a way Mendix could control the output on the client side. Really appreciate your help - all the best

answered