Select to view content in your preferred language

esriFieldTypeDouble does not seem to work and enforcing Precision

2265
8
11-10-2017 10:52 PM
Siew_WeiGoh2
Regular Contributor

Hi,

I have set my measurement entry to esriFieldTypeDouble (see below) but that does not seem to do anything.

I can type in characters into the field instead of numbers and it was validated - and it shouldn't isn't it?

On another topic, I want to set these measurement fields to enter numbers with 3 precision. How can I apply the restriction? Same with the min/max/sum(${repeat_questions}) - I cannot work out how to set the precision to the calculations:

Thank you

SW

0 Kudos
8 Replies
IsmaelChivite
Esri Notable Contributor

Hi!  The bind::esriFieldType column is used to define the type of field that will be created in the feature layer of your form once it is published from Survey123 Connect. This is an optional (an advanced) column that is typically used when you want to overwrite the default field types mappings chosen by Survey123 Connect. There is more info about this in https://community.esri.com/groups/survey123/blog/2015/08/24/xlsform-mappings-to-arcgis-feature-servi... 

In your case, it does not seem like you should need to use the bind::esriFieldType column. Instead, you may want to simply change the type of  your question to either integer or decimal.  By doing so, the user input will be filtered so only digits can be entered.

Since ArcGIS only supports 32bit integers, using the decimal and integer type of questions will limit the length of the numbers people enter.  If this is a problem to you, you can keep the type of question as text, and then change the appearance of your question to be numbers. This will bring a digit-only keyboard into the device when the user wants to enter  the number, but will actually persist the user-input in the feature layer as a text.

IsmaelChivite
Esri Notable Contributor

On your second question regarding precision, I suggest you look at using input masks as described here. For example, if you want to limit input  to 2 decimals, you can use an inputmask value of 9.99  in the inputmask column of your XLSForm.

If you want to format the output of calculations in your form to two decimals, you can use the round function.

Siew_WeiGoh2
Regular Contributor

Hi Ismael,

Thank you for your very helpful advice and suggestions!

I have an issue with summing the repeats however. As you can see from my first posting, the results from the summation shows up both of the repeats' results instead of summing them up.

Did I have the formula wrong with the sum${repeat_questions} ?

THank you

SW

0 Kudos
by Anonymous User
Not applicable

Hi Siew,

What is the field type of the field in the repeat, is it integer or text? If it is not integer you can not sum it, as it will concat it if text, so need to set the bind type to be integer.

Phil.

0 Kudos
Siew_WeiGoh2
Regular Contributor

Hi Phil,

I've tried setting the field to be integer but it still doesn't work

I can't see what I'm doing wrong:

Any other fields that I've missed?

Thanks

SW

PS. At least I've now got the decimals down to 3 decimals

0 Kudos
by Anonymous User
Not applicable

Hi SW,

It appears you are using reserved keywords in your name column based on the screenshot. As per the documentation and xls form template for Survey123, reserved keywords can not be used for fields or choice lists. If you open the xls form and go to the types sheets, you will see the full list of reserved words that can not be used (from row 177 onwards).

Please make sure none of your surveys are using reserved words. Once you have updated the name and republished the survey, let me know if the calculation is still not working as it could also be related to the repeats and note fields, please share your xls form to take a further look.

Phil.

0 Kudos
Siew_WeiGoh2
Regular Contributor

Hi Phil,

I have changed the three named fields to unique but the form is still not working.

Am emailing you my XLS form directly.

Thanks again

SW

0 Kudos
by Anonymous User
Not applicable

Hi Siew,

I have also emailed you the resolution to your issue, however here is the outcome:

You are using note fields to store/display the calculations. Note fields (as the name suggests) are text fields and the App and ArcGIS online treat them as text. Therefore calculations that involve numbers only will still be treated as text and hence concatenated, not summed.

 

To resolve this issue, you can either change the type for these questions to decimal (not note), or set the bind::type parameter to decimal. The bind::type parameter applies to the App, whereas the bind::esri:fieldType applies to the feature service field. If you are using text fields but want them to be treated as numeric fields in both app and online, you need to set both correctly.

Hope this helps.

Phil.

0 Kudos