I have been playing with this all morning and continue to get script errors on various lines regarding the Child field upon entering a date.
Here is how I've used your script (I've tried both with the attribute rule field empty and on the child field being used):
Parent Date Field: DATE_1
Child Date Field: DATE_INSPECTION
Expects($feature, 'DATE_INSPECTION');
if ($originalfeature.DATE_INSPECTION == $feature.DATE_INSPECTION) {
return
}
var fs = FeatureSetByRelationshipName($feature, "OCGIS.DPW_TESTING_REL", ['DATE_1', 'GLOBALID'], false);
var parent_feat = First(fs);
if (IsEmpty(parent_feat)) {
return;
}
if (parent_feat.DATE_INSPECTION > $feature.DATE_1) {
return
}
return {
"edit": [
{
"className": "OCGIS.DPW_TESTING",
"updates": [{
"globalID": parent_feat.globalid,
"attributes": {
"DATE_1": $feature.DATE_INSPECTION
}]
}
]
}
The first script error message tells me the DATE_INSPECTION field can't be found on line 13. If I swap out the parent for the child field on line 6 the error message then says the DATE_INSPECTION field can't be found on line 8 (which is odd because there isn't even a field present on that line).
I do appreciate your teaching technique mentioned in your last message but I am pretty new at this and am trying my best! Thanks.