Using IF Statement for 1 Variables String Field App Survey123

751
2
Jump to solution
03-20-2023 09:12 AM
Adam_Bourque
New Contributor III

Hello everyone,

All I am trying to do is have my field "CUSTOMER_NAME -- What is your Name" to auto-calculate as the "Property Owner's Name" when you select Owner from the question above "Are you the Tenant or the Owner of this property". This way field workers don't have to retype out the name of customer they're working with when it's also the person who is the owner name of the property.

My calculation if((string-length(${are_you_the_tenant_or_owner})=5 and string-length(${OWNER_NAME}) > 0), '${OWNER_NAME}', '') 

my thought process was "Owner = 5 characters long, and this part works okay.

 

Unfortunately as seen in my screenshot though, calculation with the field app it references the Owner Name rather than the actual value of the Owner name. It will submit this record as seen as text "/Form_16/untitled_page_1/property_info/OWNER_NAME"

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

You can use the value instead.  No need to check for blank really.  Also you have quotes around the field name which is why is gave you that weird text.

if(${are_you_the_tenant_or_owner} = 'Owner', ${OWNER_NAME}, '')

This should work

 

View solution in original post

2 Replies
DougBrowning
MVP Esteemed Contributor

You can use the value instead.  No need to check for blank really.  Also you have quotes around the field name which is why is gave you that weird text.

if(${are_you_the_tenant_or_owner} = 'Owner', ${OWNER_NAME}, '')

This should work

 

Adam_Bourque
New Contributor III

Thank you Doug, this worked. Appreciate your long-term responses over the years to help us out in S123 realm.