Progress
Programming
Handbook


ASSIGN Schema Trigger Example

ASSIGN triggers execute when you assign a value to a database field (all other database triggers apply to tables). This is an example of an ASSIGN schema trigger procedure:

p-ascust.p
TRIGGER PROCEDURE FOR ASSIGN OF customer.cust-num 
    OLD VALUE oldcust. 
FOR EACH order WHERE order.cust-num = oldcust: 
  order.cust-num = customer.cust-num. 
END. 

This ASSIGN trigger changes the value of the order.cust–num field to equal the newly assigned value of customer.cust–num.

NOTE: If you enable a WRITE trigger on a table and an ASSIGN trigger on a field within that table, the ASSIGN trigger always executes before the WRITE trigger. However, if the WRITE trigger procedure assigns a value to the trigger field, this re-invokes the ASSIGN trigger.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095