Rounding numbers

HI, I am shifting a questionnaire from XML to CommCare, but I do have an issue with the function “round”, in XML is working perfectly round(${input1} div ${input2},1), but in CommCare HQ I am having this message:

Validation Error: Problem with bind for /applicationName/questionName contains invalid calculate expression [round(/application Name/question Reference/Number1 //Application Name /Question Reference /input2 ,1)] The "round" function was provided the incorrect number of arguments:2. It expected 1 arguments. in form "applicationName" Form in the "Surveys" Menu.

can anyone suggest a solution? for me

The “round” function only accepts one argument - the number round. Your example also passes in the number 1. Is that meant to round to one decimal place? This isn’t possible with CommCare’s “round” function. You can read more about that and the other available functions on this help site page.

You can mimic the behavior you’re looking for with something like this:

round(${input1} div ${input2} * 10) div 10

That will multiple the result by 10, round to the nearest integer, then divide by 10, leaving you with one decimal place.

Many thanks Ethan, I have try it out and it’s working perfectly for me.