1 TRIGGER PROCEDURE FOR CREATE OF Note.
3 DEF BUFFER MyNote
FOR Note.
4 DEF VAR note-code
AS INT NO-UNDO.
5 DEF VAR i
AS INT NO-UNDO INITIAL 0.
7 note-code
= NEXT-VALUE( NoteCode
) NO-ERROR.
8 DO WHILE CAN-FIND(MyNote
WHERE MyNote.NoteCode
= Note.NoteCode
) AND i
< 1000:
9 note-code
= NEXT-VALUE( NoteCode
) NO-ERROR.
13 FIND LAST MyNote
NO-LOCK NO-ERROR.
14 note-code
= (IF AVAILABLE(MyNote
) THEN MyNote.NoteCode
ELSE 0) + 1.
16 Note.NoteCode
= note-code.