I have a super basic Survey123 Constraint Question....

659
3
Jump to solution
02-15-2021 11:52 AM
ScottLehto3
Occasional Contributor

Okay. Here is the logic: When a site_typ value is anything but 'T', constrain the diameter value to 0.

Here is the code: if(${site_typ} != T, .= 0)

 

Seems easy enough but it does not work. 

When i change the diameter value to 0, i still get an invalid message. Please help!

ScottLehto3_0-1613418721015.png

 

0 Kudos
1 Solution

Accepted Solutions
JamieLambert
Occasional Contributor III

Hi Scott,

Try this:

if(${site_typ}!='T',.=0,.>0)

If T can also be 0 you can use if(${site_typ}!='T',.=0,.>=0)

You could also put in a calculation to pre-populate nonT responses.

Constraint.jpg

 

Cheers, Jamie.

View solution in original post

3 Replies
ScottLehto3
Occasional Contributor

It appears i cannot use a zero in the field. Although that's what I want to do. 

The constrain objects everything other than null......I dont understand the logic here.....What am i doing wrong?

0 Kudos
JamieLambert
Occasional Contributor III

Hi Scott,

Try this:

if(${site_typ}!='T',.=0,.>0)

If T can also be 0 you can use if(${site_typ}!='T',.=0,.>=0)

You could also put in a calculation to pre-populate nonT responses.

Constraint.jpg

 

Cheers, Jamie.

ScottLehto3
Occasional Contributor

That's it! Thank you.

0 Kudos