ArcGIS Pro 3.1
I want to auto populate from feature layer field "TDA_ID" to related table "assesment" with the same field "TDA_ID" and "repair_report" and also with the same field "TDA_ID".
I use this expression but did not work.
var originFeatureSet = FeatureSetByName($datastore, "TrafficDamageAssessment", ["TDA_ID"], true);
// Check if the current feature's TDA_ID is valid
if (IsEmpty($feature.TDA_ID)) {
return null;
}
var whereClause = "TDA_ID = '" + $feature.TDA_ID + "'"; // Assuming TDA_ID is a string. If it's numeric, remove the single quotes.
var relatedFeature = First(Filter(originFeatureSet, whereClause));
if (!IsEmpty(relatedFeature)) {
return relatedFeature.TDA_ID;
}
return null;
If you have a relate set up for the two tables, you can use the FeatureSetByRelationshipName function
var relatedFS = FeatureSetByRelationshipName($feature, 'relate name');
return First(relatedFS).TDA_ID
If they don't have a relationship, a note about constructing the sqlExpression for the Filter. You can make use of the Arcade variable substitution so you don't have to worry whether a value needs quotes or not
var tdaid = $feature.TDA_ID;
var relatedFeature = First(Filter(originFeatureSet, "TDA_ID = @tdaid"));
Thanks
Also, take a look at a thread. JonnesLidner's response to my question about the exact same thing was super detailed and helpful.
Thanks for the heads up