Trigger after create - update quantity field on secondary table
I have quite a simple trigger but I'm struggling to get it to work. I have two linked tables, Stock and Sales
When a Sales record is created I want the Stock.Quantity field for the linked product to reduce by 1. I have tried the following...
Stock.(Quantity := -1)
and
Stock.Quantity=Stock.Quantity-1
However neither seem to work. The quantity field on the Stock table doesn’t update.
What am I doing wrong? Thanks
1 reply
-
P.S. I can get the Stock.Quantity to update with the below trigger syntax...
let i := Stock.Quantity;
Stock.(Quantity := i - 1)
But this only works when I put it in Trigger after update - this doesn't work for me as I only want the quantity decreased on record entry rather than every update on the record. Do you know why it doesn;t work on Trigger on create? Thanks
Content aside
- 4 yrs agoLast active
- 1Replies
- 389Views