Conditional visibility on two fields together

926
4
Jump to solution
05-14-2021 03:39 PM
AyeletGreenberg
Occasional Contributor

Hi all,

I’m trying to apply conditional visibility on two fields together but not sure how to do it.

I have a Yes/No question; if ‘Yes’ is selected, a second field with a list of options will become visible. One of the options is ‘Other’. If ‘Other’ is selected, then a ‘Specify Other’ field should become visible.

The problem is that when the answer is ‘No’ for the first question, the ‘Specify Other’ field is still visible.
How can I keep the ‘Specify Other’ field close?

Thanks

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
AaronPulver
Esri Regular Contributor

You should be able to use two expressions to do this when collecting new features. There is a demo I did for the Dev Summit available on YouTube here which shows this scenario. Here is the TLDR version with some sample data:

Say you have 3 fields for collecting information about a tree:

1. "has_fruit" which is a coded value domain with "Yes" and "No" options

2. "type_of_fruit" which is coded value domain with "Apple", "Orange", "Other"

3. "other_fruit_name" which is text

You can define an expression for "type_of_fruit" so it only shows if the tree has fruit like:

DomainName($feature, "has_fruit") == "Yes"

 You can then define an expression for "other_fruit_name" so that it only shows if "type_of_fruit" is other like:

DomainName($feature, "type_of_fruit") == "Other"

Since "type_of_fruit" will only appear if "has_fruit" is "Yes", then "other_fruit_name" cannot be filled in, which means "other_fruit_name" won't appear (unless there is a default value applied for "Other").

In the case of updating an existing feature, it's possible that there are existing values which could cause the "other_fruit_name" field to appear. This can be solved by extending the second expression to also check that "has_fruit" is "Yes":

DomainName($feature, "has_fruit") == "Yes" && DomainName($feature, "type_of_fruit") == "Other"

 

 

View solution in original post

4 Replies
AaronPulver
Esri Regular Contributor

You should be able to use two expressions to do this when collecting new features. There is a demo I did for the Dev Summit available on YouTube here which shows this scenario. Here is the TLDR version with some sample data:

Say you have 3 fields for collecting information about a tree:

1. "has_fruit" which is a coded value domain with "Yes" and "No" options

2. "type_of_fruit" which is coded value domain with "Apple", "Orange", "Other"

3. "other_fruit_name" which is text

You can define an expression for "type_of_fruit" so it only shows if the tree has fruit like:

DomainName($feature, "has_fruit") == "Yes"

 You can then define an expression for "other_fruit_name" so that it only shows if "type_of_fruit" is other like:

DomainName($feature, "type_of_fruit") == "Other"

Since "type_of_fruit" will only appear if "has_fruit" is "Yes", then "other_fruit_name" cannot be filled in, which means "other_fruit_name" won't appear (unless there is a default value applied for "Other").

In the case of updating an existing feature, it's possible that there are existing values which could cause the "other_fruit_name" field to appear. This can be solved by extending the second expression to also check that "has_fruit" is "Yes":

DomainName($feature, "has_fruit") == "Yes" && DomainName($feature, "type_of_fruit") == "Other"

 

 

AyeletGreenberg
Occasional Contributor

Thanks!

0 Kudos
AyeletGreenberg
Occasional Contributor

Hi all,

I’m trying to apply conditional visibility on two fields together but not sure how to do it.

I have a Yes/No question; if ‘Yes’ is selected, a second field with a list of options will become visible. One of the options is ‘Other’. If ‘Other’ is selected, then a ‘Specify Other’ field should become visible.

The problem is that when the answer is ‘No’ for the first question, the ‘Specify Other’ field is still visible.
How can I keep the ‘Specify Other’ field close?

Thanks

Tags (3)
0 Kudos
DavinWalker2
Esri Contributor

Hi Ayelet,

This help documentation explains the process of using Arcade Expressions to set up conditional formatting.