Select to view content in your preferred language

Arcade expression works in one map, not in another. Error with $map?

1018
5
Jump to solution
03-04-2026 08:32 AM
Labels (1)
MattCotterill
Regular Contributor

I'm trying to multiple get address points that are within a parcel to show up in the parcel's pop-up window.

I got the Arcade assistant to generate some code in a simple map I made consisting of only a point and a polygon layer and it worked. When I transfer the code to a much more complicated map that I didn't create, (changing the name of the layer name and field name) I get a text execution error.

Here's the code that works:

// get addresses from RPP_Addresses layer from field 'addresses' that intersect with selected parcel
var addresses = Intersects(FeatureSetByName($map, "RPP_Addresses"), $feature);
var addressList = [];
for (var address in addresses) {
  Push(addressList, address.FullAddres);
}
return Concatenate(addressList, ", ");
 
This code does not:
 
// get addresses from Addresses layer from field 'AddressLoo' that intersect with selected parcel
var addresses = Intersects(FeatureSetByName($map, "Addresses"), $feature);
var addressList = [];
for (var address in addresses) {
  Push(addressList, address.AddressLoo);
}
return Concatenate(addressList, ", ");
 
This is the error message I get:
Test execution error: Compilation error - Line : 2, 44: Identifier not recognized. Verify test data.
 
In the bad code, the $map in Line 2, position 44 is underlined in red
 
Both point and polygon layers are in different layer groups and I can't seem to drag them out, but I can't imagine that would be the problem
0 Kudos
1 Solution

Accepted Solutions
timcneil
Esri Contributor

@MattCotterill , 

Looking at your screenshots, it looks like the $map profile variable is not valid in this scenario. When you look at the Profile variables panel in the editor, do you see $map alongside $feature and $layer?

I have a suspicion that you may be trying to author the expression on a Map Image Layer sublayer (and not a hosted feature layer). For Map Image Layer sublayers, the $map profile variable is not supported/populated.

View solution in original post

0 Kudos
5 Replies
DanielFox1
Esri Regular Contributor

Hi @MattCotterill 

Are all your inputs and variables correctly spelt and you have looked for any case sensitivities?

 

0 Kudos
MattCotterill
Regular Contributor

If I misname the address points layer in the good code, I get a different error, and no red underline under the $map. The main problem here seems to be the $map part.

0 Kudos
timcneil
Esri Contributor

@MattCotterill , 

Looking at your screenshots, it looks like the $map profile variable is not valid in this scenario. When you look at the Profile variables panel in the editor, do you see $map alongside $feature and $layer?

I have a suspicion that you may be trying to author the expression on a Map Image Layer sublayer (and not a hosted feature layer). For Map Image Layer sublayers, the $map profile variable is not supported/populated.

0 Kudos
JasonBennett
Regular Contributor

It is definitely an issue with the profile variable. Like @timcneil said, the $map profile variable is not available in all profiles. And it may not be obvious what profile you are using.

This concept caught me off guard and I asked the same question:
Solved: Using FeatureSetByName() $map identifier not recog... - Esri Community

This link was provided to me that shows there are many different Arcade profiles, and they don't all share the same profile variables:
Profile overview | ArcGIS Arcade | Esri Developer 

0 Kudos
RhettZufelt
MVP Notable Contributor

@JasonBennett Did you mark @timcneil post as the answer because you are using Map Image layer sublayer.

By your reply, it seems like you are calling it an issue with the profile not having the $map variable.

But, original post says you are using a popup window and 'breaks' when you change the layer name(s).

I ask, as if not related to Map Image layer, the same $map variable should be available in the popup profile regardless of the map.

R_

0 Kudos