In my smartform I want to read a field ("naam") from a featureset so I can use that to enter in my new feature.
I managed to select the correct feature from the featureset by it's geographical location:
// Get name from underlying buffer
var feature1 = $feature
var geometry2 = FeatureSetByName($map,"Wildweiden PairwiseBuffer")
var intersectBufferFS = Intersects(feature1, geometry2)
return intersectBufferFS
which results in:
Now, how do I extract the third field 'naam' to a string?
thanks for your time,
Bert
Solved! Go to Solution.
Your expression is returning a feature set. You probably want to use the First function to get the first feature in the intersection result (assuming there's only one or fewer). You also may want to handle the case where the feature does not intersect anything, you can use IsEmpty for this.
So it should be similar to this:
// Get name from underlying buffer
var feature1 = $feature
var geometry2 = FeatureSetByName($map,"Wildweiden PairwiseBuffer")
var feature = First(Intersects(feature1, geometry2))
if (IsEmpty(feature)) {
return null
} else {
return feature["naam"]
}
Your expression is returning a feature set. You probably want to use the First function to get the first feature in the intersection result (assuming there's only one or fewer). You also may want to handle the case where the feature does not intersect anything, you can use IsEmpty for this.
So it should be similar to this:
// Get name from underlying buffer
var feature1 = $feature
var geometry2 = FeatureSetByName($map,"Wildweiden PairwiseBuffer")
var feature = First(Intersects(feature1, geometry2))
if (IsEmpty(feature)) {
return null
} else {
return feature["naam"]
}