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

230
3
02-15-2021 11:52 AM
New Contributor III

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.

1 Solution

Accepted Solutions
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.

Cheers, Jamie.

3 Replies
New Contributor III

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?

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.

Cheers, Jamie.

New Contributor III

That's it! Thank you.