Survey123 pulldata and decimals not returning a value

180
2
11-16-2020 04:27 PM
by
New Contributor II

Hi: I have a survey123 form where I am trying to perform a pulldata calculation. A .csv file was uploaded to the survey's media file. The pulldata syntax is in the calculate column of the field survey. I want the field person to enter a depth value (feet) and then have the following question populated with the corresponding gpm value from the media .csv file.

It looks like pulldata doesn't work nicely when the lookup values have decimals? In troubleshooting, I changed the decimal values to integers and the function works. Thus, my syntax is correct, but leads me back to the decimal issue. Is there any way to get around this? I tried converting to text but my 0.00 value becomes 0 in the lookup and my 0.10 value becomes 0.1. I would like to have all lookup values be honored to two decimal places. Below is my media table.

cbolen_1-1605572842159.png

 

 

Reply
0 Kudos
2 Replies
Esri Regular Contributor

Hi @cbolen 

The pulldata() function should work with decimal input. In the following example, the user inputs a decimal depth and the gpm value returned from the CSV is also stored as a decimal:

Jim-Moore_0-1605590074922.png

It's not possible to specify how many decimal places are displayed in the form for a decimal question (trailing zeros will be dropped). If it's important to display the values to two decimal places (including trailing zeros), you could consider using text questions instead; open the CSV file in a text editor to check that the values have the desired number of digits.

If you encounter further issues please feel free to share your XLSForm & CSV files so I can take a closer look.

Best,

Jim

by
New Contributor II

Hi @Jim-Moore  - Thanks for your response. I figured out the glitch on my end. I had already went down the road of converting to text in excel and then saving to .csv. The root of the issue turns out that  I then would open the .csv in excel, which would remove the trailing zeroes that I wanted to keep (e.g., 0.00 changed to 0.0 and 0.10 changed to 0.1). As long as I don't open the .csv file again in excel, it works as intended.  Any additional qa/qc checks will be made via a text editor.

Thanks again!

Cory