Example 3: DISPLAY ARRAY using modification triggers

Form definition file "custlist.per" (same as in Example 1)

Application:
IMPORT FGL fgldialog 

SCHEMA shop 

MAIN

  DEFINE arr DYNAMIC ARRAY OF RECORD LIKE customer.*
  DEFINE cnt, ofs, len, row, i INTEGER

  DATABASE shop

  OPEN FORM f1 FROM "custlist"
  DISPLAY FORM f1

  DECLARE c1 CURSOR FOR
    SELECT id, fname, lname FROM customer 
  LET cnt = 1
  FOREACH c1 INTO arr[cnt].*
    LET cnt = cnt + 1
  END FOREACH
  CALL arr.deleteElement(cnt)

  DISPLAY ARRAY arr TO srec.* ATTRIBUTES(UNBUFFERED)
        ON UPDATE
            INPUT arr[arr_curr()].* WITHOUT DEFAULTS FROM srec[scr_line()].* ;
        ON INSERT
            INPUT arr[arr_curr()].* FROM srec[scr_line()].* ;
        ON APPEND
            INPUT arr[arr_curr()].* FROM srec[scr_line()].* ;
        ON DELETE
            LET int_flag = fgl_winQuestion("Delete",
                "Do you really want to delete this row?",
                "yes", "no|yes", "help", 0) == "no"
  END DISPLAY

END MAIN