Using Event Rule Variables for Automatic Line Numbering

You can use event rules to create automatic line numbering in form grids. Automatic line numbering means that each line in the grid will have a unique number and the lines will increment automatically as grid lines are added.

To create automatic line numbering event rules:

  1. Create a variable to hold the value of the line number. Use the data dictionary item LNID.

    VA frm_LineNumber_LNID
    
  2. Initialize the variable on the Post Dialog is Initialized event.

    VA frm_LineNumber_LNID = 0
    
  3. On the Grid Record is Fetched event, number the lines as each line is pulled from the database.

    If BC LineNumber > VA frm_LineNumber_LNID
    
    VA frm_LineNumber_LNID = BC LineNumber
    
    End If
    
  4. On the Add Last Entry Row to Grid event, increment the line number and assign the new value to the next available line.

    VA frm_LineNumber_LNID = VA frm_LineNumber_LNID + 1
    
    GC LineNumber = VA frm_LineNumber_LNID