Arcade data expression: match IDs from two feature sets (join fields, 1:1)

899
1
09-22-2021 05:02 AM
Labels (1)
Merlin
by
New Contributor III

Hi there,

this time I have a question that might be a bit tricky: how can you loop through a featureSet (fs1) and check each time if the current ID is found in another featureSet (fs2)?

I basically try to achive a join field operation from ArcGIS Pro.

To illustrate:

I want to loop through fs1 containing IDs:

Merlin_1-1632311449512.png

and for each ID in the loop, I would like to see if there is a matching ID in fs2.

My initial idea was to have a first for loop to move through the rows of fs1 and then have a second for loop nested within the first, which could pick up the current ID value and loop through fs2 to find a match. But I didnt manage to make nested for loops pointing at different featureSets working.

Any ideas?

 

Thanks in advance,

Merlin

 

 

---
Tags (2)
0 Kudos
1 Reply
JohannesLindner
MVP Frequent Contributor
var fs1 = FeatureSetByName(...)
var fs2 = FeatureSetByName(...)

for(var row1 in fs1) {
  var id1 = row1.FFGId
  var filtered_fs2 = Filter(fs2, "FFGId = @id1")
  for(var row2 in filtered_fs2) {
    // do stuff
  }
}

Have a great day!
Johannes