Select to view content in your preferred language

Arcade Pop-up return multiple values

555
4
12-04-2023 10:15 AM
BlueSky17
New Contributor III

Hello,

How to write a simple query in Arcade that would return multiple OBJECIDs....

in SQL in would be:

Objectid in (4538,41246,4002,4104,41228,36024,103255,36031)

How would my expression look like in Arcade?

I know it's a simple expression but found no help using Arcade tutorials.

Thanks.

0 Kudos
4 Replies
DavidPike
MVP Frequent Contributor

https://developers.arcgis.com/arcade/function-reference/array_functions/#includes

Not sure your exact requirement but you could maybe keep SQL and use Filter()

var fs = $map.myFeature
return Filter(fs, 'OBJECTID IN (1,2,3,4)')

 https://developers.arcgis.com/arcade/function-reference/featureset_functions/#filter 

0 Kudos
BlueSky17
New Contributor III

Thank you for your response. Actually, I realized I don't have ObjectID field, instead I am using FacilityID.

So, now my expression looks like:

 

var fs = featuresetbyname($datastore, "Meter Box")
RETURN filter(fs, 'facilityid in ("B07371314","B22661311")')

 

...but not having luck with it since I am getting this error:

Execution Error:Filter cannot accept this parameter type

I did take a look at the link you provided but it's all very vague. What I am trying to achieve is a very simple query but since arcade is a new language, I can't even find any similar example. But anyway, thank you for your help.

0 Kudos
DavidPike
MVP Frequent Contributor

can you return fs and see what type it is.  Maybe it's a feature collection.  Have you tried Featuresetbyportalitem?

0 Kudos
KenBuja
MVP Esteemed Contributor

The Filter function's SQL syntax is very picky with quotes. Try this

var fs = featuresetbyname($datastore, "Meter Box")
RETURN filter(fs, "facilityid in ('B07371314','B22661311')")

 

0 Kudos