Actions Example 6: Dynamic Default Value
Customers have a personal discount percentage. Whenever the user enters or changes the Customer ID, the customer's current discount percentage must be looked up in the CUSTOMER table and displayed as a default value in the Discount field.
If you want to make sure that the discount is only displayed AFTER the user has entered or changed the entire record, then write a constraint:
UPDATE reservation r
SET customer_discount =
WHERE customer_id = r.customer
If you want the discount percentage to be displayed IMMEDIATELY after the customer ID is entered or changed, set the Post-edit property for the Customer field to:
Set the Decision SQL to:
WHERE customer_id = :CUSTOMER
The :CUSTOMER construct is an embedded method call.
Set the Yes Action of the decision to: