When using FeatureSetByName how can I access layers in a group

613
6
01-06-2022 03:53 PM
DougBrowning
MVP Notable Contributor

Tried all kinds of slashes and there is nothing about it in the help.  FeatureSetByName cannot seem to find anything in a group.

DougBrowning_0-1641513040082.png

var GraAllot = Intersects(FeatureSetByName($map,"Grazing Allotment Polygons", ["ALLOT_NAME"], false),$feature);
return First(GraAllot).ALLOT_NAME

If I take it out of the group it all works fine.

Thanks

https://developers.arcgis.com/arcade/function-reference/data_functions/#featuresetbyname 

Also why is there no Arcade community?  Or can I just not find it.

6 Replies
AdminGIS2
New Contributor III

You could try to use one of the other featureset functions, FeatureSetById or FeatureSetByPortalItem

0 Kudos
jcarlson
MVP Honored Contributor

I'd assume there's no Arcade community specifically because of how varied the different profiles are. That is, for certain Arcade expressions, they will only be used in a Dashboard or Attribute Rule, etc., so it makes more sense to put those questions in their respective spaces. But it would be nice to have it as a tag available in all spaces where Arcade is relevant. Or really, just an Arcade community space with the different profiles as tags... I'll suggest it!

But to your question: is this a map image layer? How is it getting grouped like that?

Personally, I go with @AdminGIS2 's suggestion of using FeatureSetByPortalItem, as it will function regardless of the map's configuration, and will even work without the layer being present in the map.

- Josh Carlson
Kendall County GIS
0 Kudos
DougBrowning
MVP Notable Contributor

Thanks we are usually offline so needs to be in the map anyway.  I use by name a lot because I have to replicate the maps for 12 states.  By name I can just copy paste.  By ID would take me a lot longer.

This map I got from from a coworker - they just added in a rest service and it did that.   I moved it up but was still curious how to do it.

thanks

jcarlson
MVP Honored Contributor

I see. Yes, when you add a single layer from a Map Image service from its layer index url (.../MapServer/0), it treats it like a Feature Layer. Adding the whole Map Image service brings layers in as a grouped layer, which can't be interacted with in the same way.

- Josh Carlson
Kendall County GIS
0 Kudos
DougBrowning
MVP Notable Contributor

Yea or when you create groups in ArcMap before publish I think it creates groups.  I always wondered why Esri products never have much group support.  Even the new map viewer has groups for feature classes but not tables.  Like why not?  What advantage is there to not being able to have groups.  Plus putting the tables separate from FCs is just plain strange.  I have like 60 tables in some so there is no way I can ever move to the new map with no way to organize anything.  It seems like most javascript built maps out there have grouping.

My guess is that there is no way to access groups but maybe they will add it is my hope.

Thanks

0 Kudos
RyanBohan
Occasional Contributor III

Wow!  Glad I checked here first.  I was thinking of migrating to the new map viewer for the grouping of layers.  However FeatureSetByName is used in the arcade expressions.  
Staying in classic

0 Kudos