I have a PropertyOwnership table which has a PercentOwnership field. Please note that any property can have multiple owners, hence we require the percent ownership for each owner.
When adding a record into the PropertyOwnership table, I would like to insert a trigger that will ensure the correct percentage value is added i.e. when we add all the percent ownership of the property, it should not be greater than 100.
I have tried creating a event driven data macro for after insert/update trigger as followed:
Macro Name: InvalidOwnership
Parameter 1 name: PropertyNameTemp
Parameter 2 name: PercentOwnershipTemp
SetLocalVar Name: RunningPercent
Expression: 0
lookup each record in PropertyOwnership where PropertyName = PropertyNameTemp
SetLocalVar Name: RunningPercent
Expression : RunningPercent + PercentOwnership
If PercentOwnershipTemp + RunningPercent > 100
RaiseError.
I use the above data macro within the After insert and update trigger (table event macro) but it doesnt seem to work.
Please assist :)