Attribute rule from a related table

87
0
11-24-2020 09:04 AM
Labels (2)
KARIMLABIDI
New Contributor II

Hello,

After having searched a lot, I am writing to you because I am desperate not to find!I try to fill a field thanks to a join with an associated table. In this field, I need to retrieve a value from this table. The relationship is 1-M but I have to take the first row.

I have a script but nothing happens:

var parent_id = $feature.OBJECTID
var tbl = FeatureSetByName($datastore, "TYPES_COMMERCE");
// Filter the parent class for only related features
var parent_records = Filter(tbl, "OBJECTID = @parent_id");
var i = 0;
var new_value = 'Operational';
// Loop through each feature, create a dict of the Global ID and the new value date
for (var row in parent_records) {
new_value= row['TYPE_COMMERCE'] //Test on one value to see if it's work
}
return new_value

Any help will be very appreciated! 

Reply
0 Kudos
0 Replies