Hi everyone,
I'm currently working on a project in ArcGIS Pro and need some assistance with automating data updates between two related tables in my geodatabase. Here's the scenario:
Table 1:
Contains several material fields (TYPE_A, TYPE_B, TYPE_C, TYPE_D).
Has a calculated Total field that sums up these material fields.
I want changes in this Total field to trigger updates in Table 2.
Table 2:
Contains a Total_Available_Material field.
This field should reflect the same value as the Total field in Table 1, automatically updating whenever the Total in Table 1 changes [ Without Use Triggers in the table ( insert or update ) ]
Ensure that any changes in the material fields in Table 1 automatically update the Total_Available_Material field in Table 2.
Maintain data consistency across both tables without manual intervention.
Created a Relationship Class:
Established a relationship class between Table 1 and Table 2 using a common field (ID).
Set Up Attribute Rules:
In Table 1: Created an attribute rule to calculate the total of material fields and intended to update Table 2.
In Table 2: Created an attribute rule to update the Total_Available_Material field based on changes in Table 1.
In Table 1:
// Calculate the total of material fields in Table 1
var totalMaterial = $feature.TYPE_A + $feature.TYPE_B + $feature.TYPE_C + $feature.TYPE_D;
// Store the total in the Total field of Table 1
$feature.Total_Available_Material== totalMaterial;
// Retrieve the related records from Table 2 using the relationship class
var related_records = FeatureSetByRelationshipName($feature, "RelationShipClass");
var related_record = First(related_records);
// Update the Total_Available_Material field in Table 2
if (!IsEmpty(related_record)) {
related_record.Total_Available_Material = totalMaterial;
return totalMaterial;
} else {
return totalMaterial; // Return the total if no related record is found
}
The attribute rule in Table 1 does not seem to trigger the update in Table 2 automatically.
Unsure of the best approach to ensure that updates in Table 1 are reflected in Table 2 without manual intervention.
How can I modify my approach or the Arcade expressions to achieve the desired automated updates between these two tables?
Any best practices or tips for setting up such dependencies between related tables in ArcGIS Pro?
*Notice
If the scenario wasn't clear easily want to force attribute rule to work without using triggers [ update , insert ]
Thank you in advance for your help!
Best regards, [JIMMY]