I am looking for a way to return the layer name (as seen in the table of contents) using Arcade in a popup in AGOL.
Reason - I have 60+ individual study areas and when a user clicks on one it would be nice to have the pop up tell them which one it is. Each study area only has 1 feature in it. The attributes do not, currently, contain the study area name.
Solution 1 - add a field for each study area and include the name for easy pop up
Solution 2 - find out if Arcade can do it already
I know solution 1 will work but I am more intrigued to understand Arcade better and see if this is a function exists!
Solved! Go to Solution.
Hi David Fotheringham ,
I was expecting to find a name property on the $layer object, but there doesn't seem to be one. I assume the optimal option would be to work with a single feature layer and the additional attribute to hold the study area for each feature.
You can use a python script to merge them together and add the additional attribute and publish the feature layer again.
Hi David Fotheringham ,
I was expecting to find a name property on the $layer object, but there doesn't seem to be one. I assume the optimal option would be to work with a single feature layer and the additional attribute to hold the study area for each feature.
You can use a python script to merge them together and add the additional attribute and publish the feature layer again.
Thanks Xander Bakker. Glad it was not just me that could not find a 'name' property. I'll revert back just updating the layers with a 'name' field directly.
David,
It is low tec but you can use Concatenate and just type out the layer name.
Example: Concatenate(['Layer Name',$feature.Label], ':')
Thanks. This is the solution I needed!
@cat206 This will return the custom Layer title as set in a Web Map :
GetFeatureSetInfo(GetFeatureSet($feature)).webMapLayerTitle
More info about different properties of FeatureSets :
https://developers.arcgis.com/arcade/function-reference/featureset_functions/#getfeaturesetinfo