Select to view content in your preferred language

Convert sql query to Arcade Expression

124
2
Jump to solution
Monday
Labels (1)
JoshLay1
Emerging Contributor

I have a simple sql expression used to filter on a layer in ArcGIS Pro

Field1 = 'Open' AND Field2 = 'LP' AND Field3 IN (10, 11, 12, 13, 14)

I would like to convert it to an Arcade Expression for use in a Velocity filter.  Below is what I have come up with so far but it is returning some syntax errors.

$feature.Field1 = 'Open' && $feature.Field2 = 'LP' && $feature.Field3 IN (10, 11, 12, 13, 14)

Does anyone have suggestions how to convert the sql query to a arcade expression?

Thanks

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
RyanUthoff
MVP Regular Contributor

The Arcade expression below might work. I think you'll need double equal signs. And the syntax for "IN" is a little different in Arcade. https://developers.arcgis.com/arcade/function-reference/array_functions/#includes

$feature.Field1 == 'Open' && $feature.Field2 == 'LP' && Includes([10, 11, 12, 13, 14], $feature.Field3)

 

View solution in original post

0 Kudos
2 Replies
RyanUthoff
MVP Regular Contributor

The Arcade expression below might work. I think you'll need double equal signs. And the syntax for "IN" is a little different in Arcade. https://developers.arcgis.com/arcade/function-reference/array_functions/#includes

$feature.Field1 == 'Open' && $feature.Field2 == 'LP' && Includes([10, 11, 12, 13, 14], $feature.Field3)

 

0 Kudos
JoshLay1
Emerging Contributor

The Arcade Expression you provided works perfectly.  Thanks for taking time to solve my problem.  

0 Kudos