Filtering domains using conditional visibility in Fieldmaps smart form - Arcade help needed

770
1
12-15-2022 11:12 AM
LaraMulvaney
New Contributor

I'm new to Arcade and need to know if something is possible in conditional visibility expression.  I have a domain list for Hydrant Manufacturers and one for Hydrant Models and fields for Manufacturer and Models exist in my Fieldmaps form.   Domains are text type.

Each manufacturer has only a subset of all of models in the domain list that are affiliated.    I want to be able to filter the list of models visible based on a particular manufacturer chosen from the domain list.   Can conditional visibility statement be used for this purpose to filter visible domain choices of model based on a selected manufacturer?

This is what I have so far. 

if (DomainName($feature,"MANUFACTURER")=='AMERICAN FOUNDRY') {
return 'DRY TOP';}
ELSE if (DomainName($feature,"MANUFACTURER")=='AMERICAN DARLING') {

return ['B-62-B', 'B-50-B', 'B-80-B']
}

//add additional manufacturers, and affiliated model domain choices

American Foundry manufacturer choice works and returns text DRY TOP but that is the only choice for that manufacturer. Other manufacturers should have array of model choices to chose from but not the entire model domain list.   Possible to do with arcade expression? 

 

0 Kudos
1 Reply
JustinReynolds
Occasional Contributor III

Conditional Visibility only applies to a form element (the field or group itself)  and not to the values of a domain. So, the short answer is no.

Visibility expressions utilize the Constraint Arcade Profile and must return either True or False.
https://developers.arcgis.com/arcade/profiles/constraint/



The functionality you are describing is called contingent values (where one domain controls what is available in another domain).  You can find documentation on contingent values here https://doc.arcgis.com/en/field-maps/android/help/configure-the-form.htm.

You must first configure them in ArcGIS Pro and can't use them in ArcGIS Enterprise yet.  Also, if I remember correctly the data in the service must be referenced (i.e. it won't work for hosted data).

You may want to explore subtypes instead.
https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/an-overview-of-subtypes.htm


On a side note, you can't return complex object types in your arcade expressions.  In the example above, you are returning an array (list).  The allowed return types for any given profile you are using can be found in the profile's documentation.  

JustinReynolds_0-1671161342827.png

 






- Justin Reynolds, PE
0 Kudos