Decimal Type Question

in a situation where the first question asks for symptoms: with options
being fever or other symptoms ,

the the second question requires an input for temperature as a decimal type
question, where if if the patient had fever temp should be between two
values say 100 to 109 inclusive and when patient did not show fever temp
should be 96 to 101.

How do I write the validation code for that?

When I do write it, the preview shows the values as incorrect if i type in
any range of number. But if I leave it blank the field is correct.

Hi!

You can read a bit more about common logic expressions on our wiki here:
https://confluence.dimagi.com/display/commcarepublic/Common+Logic+and+Calculations

but the general structure of a validation condition like this would be

if(selected
https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-selected(#form/symptoms,
'fever'), . >= 100 and . <= 109, . >= 96 and . <= 101)

One quick clarification on leaving questions blank:

Unless a user specifies that a question is "required", a blank input will
not trigger the validation for the question input. CommCare doesn't apply
validation logic to an "unanswered" question, which is why you were able to
proceed.

-Clayton

ยทยทยท On Thu, Dec 8, 2016 at 11:56 AM, Anon wrote:

in a situation where the first question asks for symptoms: with options
being fever or other symptoms ,

the the second question requires an input for temperature as a decimal
type question, where if if the patient had fever temp should be between two
values say 100 to 109 inclusive and when patient did not show fever temp
should be 96 to 101.

How do I write the validation code for that?

When I do write it, the preview shows the values as incorrect if i type in
any range of number. But if I leave it blank the field is correct.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.