Select to view content in your preferred language

Arcade expression to populate hosted table field

171
1
Jump to solution
04-01-2025 02:17 PM
Labels (1)
TKSHEP
by
Frequent Contributor

I am looking for help with an arcade expression to autopopulate a field on an hosted table based on a field in a hosted feature layer.  Example: hosted table & hosted feature - fields code_number & status 

If code_number on both hosted table & hosted feature match then return the status from the hosted feature into the corresponding status field into the hosted table.

I hope this makes sense, any help would be greatly appreciated.

Thank you!

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Mowgli_GIS
Occasional Contributor

Hi, I've never done this with a hosted table, but I used a similar script based on matching fields between hosted layers to extract and then insert data from one layer to the other.  My understanding of Arcade is basic, but I adjusted the script to fit what I think you're trying to do, but again this is if they were both hosted layers, not sure how it would need to be adjusted for a hosted table:

var Hfeature = FeatureSetByName($map, "Hosted Feature", ['code_number','status'])

for (var f in Hfeature) {
  if (f.code_number == $feature.code_number) {
return (f.status)
  } else {
    return 'No Status'
  }
}

Hopefully this helps or at least gets you part of the way!

View solution in original post

1 Reply
Mowgli_GIS
Occasional Contributor

Hi, I've never done this with a hosted table, but I used a similar script based on matching fields between hosted layers to extract and then insert data from one layer to the other.  My understanding of Arcade is basic, but I adjusted the script to fit what I think you're trying to do, but again this is if they were both hosted layers, not sure how it would need to be adjusted for a hosted table:

var Hfeature = FeatureSetByName($map, "Hosted Feature", ['code_number','status'])

for (var f in Hfeature) {
  if (f.code_number == $feature.code_number) {
return (f.status)
  } else {
    return 'No Status'
  }
}

Hopefully this helps or at least gets you part of the way!