Include XPATH functions format-number and format-integer

What is the general goal of the feature?
There are many situations where we need to format numbers and currently there are not any possibilities to do it with ODK. The idea is to implement already defined XPATH functions: XPATH Formatting Numbers and (optional) XPATH Formatting integers

What are some example use cases for this feature?
Following are taken from XPATH specifications:

The following examples assume a default decimal format in which the chosen digits are the ASCII digits 0-9, the decimal separator is ".", the grouping separator is ",", the minus-sign is "-", and the percent-sign is "%".

The expression format-number(12345.6, '#,###.00') returns "12,345.60".

The expression format-number(12345678.9, '9,999.99') returns "12,345,678.90".

The expression format-number(123.9, '9999') returns "0124".

The expression format-number(0.14, '01%') returns "14%".

The expression format-number(-6, '000') returns "-006".

The following example assumes the existence of a decimal format named 'ch' in which the grouping separator is ʹ and the decimal separator is ·:

The expression format-number(1234.5678, '##0·00', 'ch') returns "1ʹ234·57".

The following examples assume that the exponent separator is in decimal format 'fortran' is 'E':

The expression format-number(1234.5678, '00.000E0', 'fortran') returns "12.346E2".

The expression format-number(0.234, '0.0E0', 'fortran') returns "2.3E-1".

The expression format-number(0.234, '#.00E0', 'fortran') returns "0.23E0".

The expression format-number(0.234, '.00E0', 'fortran') returns ".23E0".

What can you contribute to making this feature a reality? Just testing, I do not have enough technical skills to help it.

3 Likes

Hi!
Were you able to find a workaround? I need to display totals in a note widget so I can apply font size and color (so it will be easier for data collectors to see/check).I used to deploy surveys via SurveyCTO. And it was a common function. I didn't know ODK doesn't have this feature. :sob: I hope ODK would consider implementing this function..
Trying to vote for this feature but it saying I am out of votes..