Hi there
I have a sample survey where I have a complex calcualtion, however I am interested in getting all answers with 2 decimal places only
I see that we can edit the schema length, but with the way field length works we wont always consistently get 2dp
Thanks in advance
John P
Solved! Go to Solution.
Hi John,
Have you considered using the 'round' function on your calculation:
round(${test}*1.14569875,2)
This will round the answer displayed to 2 decimal places and also submit the answer to feature service as only 2 decimal places.
Regards,
Phil.
Hi John,
Have you considered using the 'round' function on your calculation:
round(${test}*1.14569875,2)
This will round the answer displayed to 2 decimal places and also submit the answer to feature service as only 2 decimal places.
Regards,
Phil.
Phil, I see how this works for decimals but how can whole numbers be rounded? I need to round to the nearest 100.
Hi Marc,
There are a couple of ways to round to the hundreds (and by extension, any order of magnitude):
Do these work when setting up the feature report word doc template? I am trying to round some lat/long values but don't want to go through the effort of creating a new field with a calculation in the Survey123 app.
Would a format like this work?: ${round(q,-2)}
I am wondering if this works for more than just the conditional element calcs as shown here: https://doc.arcgis.com/en/survey123/browser/analyze-results/featurereporttemplates.htm
${if integer1>0}
Hi Marcus,
No, this is not supported in the feature report templates. The best way is to set up a hidden question on survey that does the rounding and final calculation, and then display that in the your feature report, not the originally entered value.
Phil.
Hey Phil, is there a way to round up? For example if the result of calculation is 71.415, is there a way to get the value to be 72? I have a calculation for estimating no. of employees where I'd rather have a conservative estimate instead of nearest round number.
Hi @PrachiPatel,
Are you refering in the XLSForm in Connect/field app, or in the feature report template?
In either case there is no out of box supported function such as roundup that you may see supported in Excel, as the XSLForm open standard does not support it.
You could try and build your own expression to achieve what you are after, similar to what James outlined above. It will all depend on the values and types of number you need to round up to.
Regards,
Phil.
Hi Phil
I am calculating in the .xls form. Thank you for your response. I went ahead and put the following calculation and it is working
if( (coalesce(${AREA},0) div 200) > round((coalesce(${AREA},0) div 200),0), round((coalesce(${AREA},0) div 200),0) +1 , round((coalesce(${AREA},0) div 200),0))