Select to view content in your preferred language

Attribute in popup from another layer

169
2
Jump to solution
12-13-2024 03:13 AM
vlakol
by
Emerging Contributor

Hi all, i need show attribute in popup. I have arcade script and that work in map viewer, but in Field Maps not work. Field maps write error with error code 22.

can someone help me?

Thank you.

Here is error:

The name of the expression: expr0
Expression title: taxon_tid
Error domain: com.esri.arcgisruntime.ArcGISRuntimeException
Error code: 22
Error description: Check getCause() for further error information.

I have layer with name "bio body verej" and i need in popup attribute "tid" from layer "nazev taxonu bod".

var ogc_fid=$feature.ogc_fid
var taxon_fs=FeatureSetByName($map, "Nazev taxonu bod",["ogc_fid","tid"])
var taxon_fs_filter=Filter(taxon_fs, "ogc_fid=@ogc_fid")
var tid_filter=First(taxon_fs_filter)
return tid_filter.tid

 

field_maps.jpg

0 Kudos
1 Solution

Accepted Solutions
ChristopherCounsell
MVP Regular Contributor

Try replacing the @ with this:

var taxon_fs_filter=Filter(taxon_fs, "ogc_fid=@ogc_fid")

"ogc_fid=@ogc_fid"

To

var taxon_fs_filter=Filter(taxon_fs, "ogc_fid=" + ogc_fid)

I'd also recommend:

  • Check case sensitivity of map layer name or use featuresetbyid
  • Add handling for null values, when a result is not returned 
  • Use a different variable name for ogc_fid as it's just confusing 

View solution in original post

0 Kudos
2 Replies
ChristopherCounsell
MVP Regular Contributor

Try replacing the @ with this:

var taxon_fs_filter=Filter(taxon_fs, "ogc_fid=@ogc_fid")

"ogc_fid=@ogc_fid"

To

var taxon_fs_filter=Filter(taxon_fs, "ogc_fid=" + ogc_fid)

I'd also recommend:

  • Check case sensitivity of map layer name or use featuresetbyid
  • Add handling for null values, when a result is not returned 
  • Use a different variable name for ogc_fid as it's just confusing 
0 Kudos
vlakol
by
Emerging Contributor

Super, Thank you very much. Problem was in featuresetbyname. After changing to featuresetbyid, all works.

0 Kudos