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.
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
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.
can you return fs and see what type it is. Maybe it's a feature collection. Have you tried Featuresetbyportalitem?
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')")