How to stop Survey123 adding .0 to numbers when it creates itemsets.csv

560
7
01-09-2018 07:37 PM
MarcGraham1
Occasional Contributor

Hi all,

I am creating a survey with a large number of records using multiple dependent cascading selects and an external choices tab.  When I save the excel and Survey123 creates the itemsets.csv file, it adds .0 to the end of some of the values as they are integers.  However I have stored them in the excel spreadsheet as type "text", and have added esriFieldTypeString to the survey tab, so I would not expect this.

In the survey tab:

in the external_choices tab:

in the itemsets.csv file:

in the survey:

This is casuing me issues when I try and use pulldata to automatically populate other fieilds from an external csv based on the results of this field, as it does not expect the .0 and so the lookup fails.

If I manually find and replace .0" for " using notepad++ in itemsets.csv then everything works ok.  This is not an acceptable solution for the client however.

Is there a way to prevent this from happening?

Regards,

Marc

Ismael ChiviteJames Tedrick

Reply
0 Kudos
7 Replies
Philip-Wilson
Esri Frequent Contributor

Hi Marc,

This is a known issue with external selects using numeric choices in the itemsets.csv, it is a limitation of current pyxform implementation. We have an open issue in our backlog to which I have added your comments.

As a workaround for your pulldata() funciton, you could add an additional field with integer type and use a calculate to cast the select_one answer as an integer. You can then make the select_one question have an esri field type of null or make it hidden, and also do the same for the integer question, unless you want that store either or both of those in the feature service. The pulldata() function would then point at the integer answer.

Regards,

Phil.

Reply
0 Kudos
Philip-Wilson
Esri Frequent Contributor

As another alternative you could use the following python script to update the itemsets.csv file in the media folder after the survey has been published: https://community.esri.com/groups/survey123/blog/2017/12/08/an-alternative-way-to-update-the-media-f... 

Or as you pointed out the itemsets.csv can be modified before publishing to remove the .0

Phil.

Reply
0 Kudos
MarcGraham1
Occasional Contributor

Hi Phil,

Thanks for your comments.  The problem is the stand ID's are sometimes text and sometimes numbers, so I need everything to be treated as text, even if it is actually a number.

Cheers,

Marc

ChelseyAiton2
New Contributor II

Has there been any development on this issue? I too need to have a mix of IDs that are text and numbers, everything needs to be a string. The data gets stored with ".0" after the number. 

Reply
0 Kudos
DataOfficer
Occasional Contributor III

I'm having this issue too, with an external select_one containing both text and integers. My short term fix has been to add ' in front of the numbers (e.g. '3004 instead of 3004), but I expect this may cause me some grief further down the line.

Reply
0 Kudos
Philip-Wilson
Esri Frequent Contributor

Hi Rob,

With the latest version of Survey123 3.11 which will be available in a few weeks, you will be able to use a select one or select multiple from file, meaning you can point your select one directly to a csv file in the media folder. This should resolve the issue you are having above as you can format the csv in the way you need to, and using a ' in front of number is also good practice, and should not cause issues down the track.

You can check out all the latest features and enhancements coming in 3.11 in the RC builds available on Early Adopter Community.

Regards,

Phil.

DataOfficer
Occasional Contributor III

Hi Philip Wilson,

Thank you that is very useful to know. I can see in the documentation there are some limitations in relation to cascading selects which may limit our use of this new feature for now, but I look forward to seeing how it develops. We are already using additional csv files for pulldata functions so this would be a logical step for managing some of our choice lists also.

Thanks,
Rob

Reply
0 Kudos