Select to view content in your preferred language

How to pass an attribute from a field in a feature class to a field in its related table, then based on the attribute populate a related table field

497
1
12-13-2023 12:08 PM
EricGlover3
Occasional Contributor

Hi Esri Community,

I have a feature class named BMPs and it contains a field called BMPType.  There are 20 choices in the dropdown for this field.  It has a related table named BMPInspections.  The GlobalID of the feature is related to the ParentGUID of the inspection table with a 1:M relationship.  The inspection table has a field names BMPSubtype.  There are 8 attributes for this field. 

For example, if the features BMPType field has an attribute of "Sand Filter" then I want it to populate the inspection table BMPSubtype field with "Filtering" when an inspection is being created in Field Maps. Basically, when the BMPType field in the feature is populated with either "Sand Filter", "Media Filter" or "Vegetation Filter Strip" when an inspection is created, I want the BMTSubtype field in the inspection table to populate with "Filtering". 

If the BMPType field in the feature is populated with either "Dry Well" or "Leaching Catch Basin" then the inspection table will populate with "Dry Well/Leaching CB".  

There are several scenarios like this, but you get the picture.

Any help with this would be greatly appreciated!

 

0 Kudos
1 Reply
VanessaSimps
Frequent Contributor

I just did something like this yesterday, does this help? 

var oldValue = $originalFeature['DAY'];
var newValue = $feature['DAY'];
var originalFieldA = $originalFeature['CollectionDay'];

// Your logic to update CollectionDay with the first letter of DAY
// Additional condition for Thursday = R 
// If DAY hasn't changed, keep CollectionDay as it is
var newValue = $feature.DAY;

if (newValue == "THU") {
   return "R";
}
else {
   if (newValue == "MON") {
      return "M";
   }
   else {
      if (newValue == "TUE") {
         return "T";
      }
      else {
         if (newValue == "WED") {
            return "W";
         }
         else {
            if (newValue == "FRI") {
               return "F";
            } 
            else {
               return $originalFeature['CollectionDay'];
            }
         }
      }
   }
}

 

0 Kudos