Handling the current row in a list

To set the current row in a list driven by a DISPLAY ARRAY or INPUT ARRAY sub-dialog, use the DIALOG.setCurrentRow() method. This method takes the name of the screen array and the new row index as parameter:
DIALOG ATTRIBUTES(UNBUFFERED)
   DISPLAY ARRAY p_items TO sa.*
   ...
   ON ACTION move_to_x 
      LET row = askForNewRow()
      CALL DIALOG.setCurrentRow("sa", row)
      NEXT FIELD item_num 
   ...
END DIALOG

Calling the DIALOG.setCurrentRow() method will not execute control blocks such as BEFORE ROW and AFTER ROW, and will not set the focus. If you want to set the focus to the list, you must use the NEXT FIELD instruction. This works with DISPLAY ARRAY as well as with INPUT ARRAY.

Use this method with care, leave the dialog handle normal navigation automatically, and jump to a specific row only in the context of an ON ACTION block.

To query the current row of a list, use the DIALOG.getCurrentRow() method.

The singular-dialog specific functions FGL_SET_ARR_CURR(), ARR_CURR() and ARR_COUNT() are also supported. These functions work in the context of the current list having the focus. Note however that a call to FGL_SET_ARR_CURR() triggers control blocks such as BEFORE ROW, while DIALOG.setCurrentRow() does not trigger any control block.