BEFORE ROW block

The BEFORE ROW block is executed when a DISPLAY ARRAY or INPUT ARRAY list gets the focus, or when the user moves to another row inside a list. This trigger can also be executed in other situations, for example when you delete a row, or when the user tries to insert a row but the maximum number of rows in the list is reached.

You typically do some dialog setup / message display in the BEFORE ROW block, because it indicates that the user selected a new row. Do not use this trigger to detect focus changes; Use the BEFORE DISPLAY or BEFORE INPUT blocks instead.

In DISPLAY ARRAY, BEFORE ROW is executed after the BEFORE DISPLAY block. In INPUT ARRAY, BEFORE ROW is executed before the BEFORE INSERT and BEFORE FIELD blocks and after the BEFORE INPUT blocks.

When the dialog starts, BEFORE ROW will only be executed if the list has received the focus and there is a current row (i.e. the array is not empty). If you have other elements in the form which can get the focus before the list, BEFORE ROW will not be triggered when the dialog starts. You must pay attention to this, because this behavior is different to the behavior of singular DISPLAY ARRAY or INPUT ARRAY. In singular dialogs, the BEFORE ROW block is always executed when the dialog starts (and there are rows in the array).

When called in this block, the DIALOG.getCurrentRow() method returns the index of the current row.

In this example the BEFORE ROW block displays a message with the current row number:

   DISPLAY ARRAY p_items TO s_items.*
     BEFORE ROW
       MESSAGE "We are in items, on row #", DIALOG.getCurrentRow("s_items")