AnsweredAssumed Answered

Require decimal

Question asked by ndammeyer@nps.gov_nps on Feb 11, 2019
Latest reply on Feb 12, 2019 by ndammeyer@nps.gov_nps

I'm trying to create a decimal data type in Survey123 to match my data entry QA/QC requirements and I'm running into a problem.

 

Here's my example:  Enter Water temperature which can range from -1.0 to 35.0 and we require temperature is recorded to a tenth of a degree. 

 

So we want to constrain to this range and require one decimal place (tenths).

 

I tried this code in the constraint field:

 

.>-1.1 and .<35.0 and regex(., '^-?[0-9]{1,2}\.[0-9]{1}$')

 

If the final value in the tenths place is 0 (e.g., 24.0) I get a constraint error, it will accept any value 1-9.

If I don't require a digit in the tenths place (....\.[0-9]{1}...) it will allow the zero in the tenths place

 

I tried using an inputMask but I don't like that I would have to require 4 digits to allow for the full range (e.g., 26.4) which would require entering a leading 0 for temps in the single digits (e.g., 05.4).

 

 

I'm new to this so any insights would be appreciated!

thanks

 

James I tagged you since you provided an answer for someone else that is super close to getting at this for me!

Outcomes