Updating an existing record
- Last Updated: March 24, 2022
- 2 minute read
- Corticon
- Version 6.3
- Documentation
As you just learned, if the Rulesheet processes an entity instance that has the same primary key value as an existing record in the database, it updates that record in the database.
Let’s update the record that we just added (625D). In the AddRecord.ert Ruletest, delete the output and modify the Cargo.volume and Cargo.weight attributes in the Input as shown here (make sure that you DO NOT change the 625D primary key value):
![]()
Run the Ruletest. You now see the following Output:
![]()
Because we modified the value of Cargo.weight to 150000, the rule in the AddRecord.ers Rulesheet assigns the value HEAVY to Cargo.container.
Let’s see if this change is reflected in the database. In SQL Server Management Studio, right-click dbo.Cargo and select Select Top 1000 Rows. You should be able to see the following changes in the record:
![]()