1 TRIGGER PROCEDURE FOR WRITE OF Variation
OLD BUFFER old-VAR.
3 /* {inc
/audit.i
"Variation"} */
5 FUNCTION get-last-variation
RETURNS INTEGER
6 ( INPUT prj-code
AS INTEGER ) FORWARD.
10 Variation.VariationCode
= get-last-variation
(Variation.ProjectCode
).
11 ELSE IF Variation.ProjectCode
<> old-Var.ProjectCode
12 OR Variation.VariationCode
<> old-Var.VariationCode
THEN DO:
13 IF Variation.ProjectCode
<> old-Var.ProjectCode
THEN
14 Variation.VariationCode
= get-last-variation
(Variation.ProjectCode
).
15 FOR EACH VariationFlow
OF old-Var
EXCLUSIVE-LOCK:
16 VariationFlow.ProjectCode
= Variation.ProjectCode.
17 VariationFlow.VariationCode
= Variation.VariationCode.
23 FUNCTION get-last-variation
RETURNS INTEGER ( INPUT prj-code
AS INTEGER ).
24 DEF BUFFER LastVar
FOR Variation.
26 FIND LAST LastVar
WHERE LastVar.ProjectCode
= prj-code
27 AND RECID(LastVar
) <> RECID(Variation
) NO-LOCK NO-ERROR.
28 IF AVAILABLE(LastVar
) THEN RETURN LastVar.VariationCode
+ 1.