Display output in decimal number

Hi Commcare users,
I would like to display the result of two decimal numbers in label field ans show it for the mobile workers.
I used the regex fonction to limit the numbers of decimal in the decimal fields. But when the result of the difference of the 2 decimal numbers is displayed, I have a lot of one digit after the decimal number in the label field.
Need your help to have just one digit after the decimal number in the label field.
Many thanks for your help !
Felix

Hi Felix,

You'll need to restrict the number of digits returned after any mathematical operations have been performed on the numbers. For instructions on how to do this, see:
Round a number to a certain decimal place

FYI This is the developers forum - for people hosting their own CommCare servers. You'd likely get more responses on the users forum.

  • Ethan

Hi Ethan, Great, Thanks a lot for this support.
Another problem I come accross is
I want to have the difference between the measure of 2 sizes, size 1 and size 2.
I created a hidden field that calculates the difference between the 2 sizes. size 1 can be less than or greater than size 2.
To have the result in absolute value, I add the abs fonction in the hidden value to calculate the difference between the 2 sizes like this: abs(#form/taille_mesure_1 - #form/taille_mesure_2)
After I display the result to show in a label field for the mobile users, but it's not work.
Thanks for your help once again!
Felix