Default sequence number to the next available sequence number.

/* Default sequence number to the next available sequence number. */
Local boolean &found;

&found = False;
If RecordNew(UP_APP_STUDENT.EFFSEQ) Then
   &MAXSEQNO = 0;
   For &I = 1 To ActiveRowCount(Record.UP_APP_STUDENT);
      &I_EFFDT = FetchValue(UP_APP_STUDENT.EFFDT, &I);
      rem WinMessage(&I_EFFDT, 0);
      If &I <> CurrentRowNumber(1) And
            &I_EFFDT = UP_APP_STUDENT.EFFDT Then
         &SEQNO = FetchValue(UP_APP_STUDENT.EFFSEQ, &I);
       
         &found = True;
         If &SEQNO > &MAXSEQNO Then
            &MAXSEQNO = &SEQNO;
         End-If;
      End-If;
   End-For;
   rem WinMessage(&MAXSEQNO, 0);
 
   If &found Then
      &SEQNO = &MAXSEQNO + 1;
      If &SEQNO > 99 Then
         &SEQNO = 99;
      End-If;
   Else
      &SEQNO = 0;
   End-If;
   UP_APP_STUDENT.EFFSEQ = &SEQNO;
End-If;

Comments