Make date field wider to accommodate 10 digits properly.
[capital-apms-progress.git] / trigger / crnote.p
blobb41d1edc8857b140fe3b2d69ddcc93ad25732408
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.
10 i = i + 1.
11 END.
12 IF i >= 1000 THEN DO:
13 FIND LAST MyNote NO-LOCK NO-ERROR.
14 note-code = (IF AVAILABLE(MyNote) THEN MyNote.NoteCode ELSE 0) + 1.
15 END.
16 Note.NoteCode = note-code.