Arcade Expression for field "includes" a value

2815
2
Jump to solution
05-24-2022 09:03 AM
JasonCyphers
Occasional Contributor III

Is there an arcade expression for "feature includes value", instead of != or == 

I have a feature that is used during an inspection to identify issues with a facility.  When crews go back to fix the issues identified during the inspection, there is a text field for each of the predetermined issues that they use to note what they did to resolve the issue (for example, Issues include Corrosion, Code Violation, and Landscape Conflict - additional attribute fields are Corrosion Resolution, Code Violation Resolution, and Landscape Conflict Resolution)

For example, if the "Issues" field of my feature looks like this:

ObjectIDIssues
1Corrosion, Code Violation
2Corrosion
3Corrosion, Code Violation, Landscape Conflict

 

I want to configure Conditional Visibility in a Field Maps form to only show a Code Violation Resolution attribute field when the Issues attribute field includes/contains "Code Violation" (when repairing issues identified in ObjectID's 1 & 3 above, I'd see the Code Violation Resolution field, when repairing ObjectID 2 above, I wouldn't).

 

 

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

Yes! It's literally the function Includes. But that assumes you're working with an array of values, which you could get with Split.

var issues = Split($feature.issues, ', ')

return Includes(issues, 'Corrosion')

If you don't want to deal with an array, there's also Find. This will return the position in the string in which the searched value shows up. In other words, any value greater than -1 means your searched string is in there somewhere.

Find('Corrosion', $feature.issues) > -1
- Josh Carlson
Kendall County GIS

View solution in original post

2 Replies
jcarlson
MVP Esteemed Contributor

Yes! It's literally the function Includes. But that assumes you're working with an array of values, which you could get with Split.

var issues = Split($feature.issues, ', ')

return Includes(issues, 'Corrosion')

If you don't want to deal with an array, there's also Find. This will return the position in the string in which the searched value shows up. In other words, any value greater than -1 means your searched string is in there somewhere.

Find('Corrosion', $feature.issues) > -1
- Josh Carlson
Kendall County GIS
JasonCyphers
Occasional Contributor III

Perfect, Thanks!

My fast scrolling went right past that section of data functions when I was searching for it! 

0 Kudos