Morning,
I am fairly new to Experience Builder and writing label expressions in Experience builder which I believe uses JavaScript/Arcade?
I have a field called "WAYMARK_VALUE" which has been rounded to 4 decimal places in the 'Fields' list and it also shows correctly in the pop up box shown below. When applying the labels it seem to have a mixture of decimal places, from zero places and to the correct 4 places, so i am a bit puzzled why this is not working?
I have copied a piece of script I found online which i thought would work, but unfortunately it doesn't seem to consistently work, so any help would be much appreciated.
Once i have the rounding issue sorted, i would then like to add multiple attributes to my label expression, ideally the "ELR" attribute and the "WAYMARK_VALUE" rounded to 4 decimal places. (ie; BLT1 - 47.0880)
Many thanks,
Steve
Solved! Go to Solution.
Thanks for your question.
Looking into the documentation for the "Round" function, it seems to be expected that any trailing zeros will be truncated - which I assume is the behaviour you are experiencing, rather than the rounding not working at all? https://developers.arcgis.com/arcade/function-reference/math_functions/#round
From what I can tell, there does not seem to be a way at the moment to stop this behaviour. If you take a look through this documentation: How To: Retain Trailing Zeros after the Decimal Point in a Label Using Arcade in ArcGIS Pr (esri.com... we do have a workflow in Arcade to resolve this in ArcGIS Pro that is worth trying for your labels - although I have not yet been able to get this to work in ArcGIS Online.
Let me know if you have any questions about any of the above!
Thanks,
Issy
Thanks for your question.
Looking into the documentation for the "Round" function, it seems to be expected that any trailing zeros will be truncated - which I assume is the behaviour you are experiencing, rather than the rounding not working at all? https://developers.arcgis.com/arcade/function-reference/math_functions/#round
From what I can tell, there does not seem to be a way at the moment to stop this behaviour. If you take a look through this documentation: How To: Retain Trailing Zeros after the Decimal Point in a Label Using Arcade in ArcGIS Pr (esri.com... we do have a workflow in Arcade to resolve this in ArcGIS Pro that is worth trying for your labels - although I have not yet been able to get this to work in ArcGIS Online.
Let me know if you have any questions about any of the above!
Thanks,
Issy
Afternoon Issy,
Thank you for getting back to me on this and supplying the links to the information. I have played around with the Text function and it seems to have worked in ArcGIS Online Experience builder on the labels 🙂
This was the script that seems to work for me: