BAM code specifics

Some code practice that is specific to BAM.

Next field instructions

In a function where you need to set the focus to a specific field, you can not use a NEXT FIELD instruction. The NEXT FIELD statement only works in the scope of a dialog that is not referenced in a function.

Instead you need to make a call to the nextField() method of the ui.DIALOG class. This method allows you to set the focus to a specified field. However, unlike NEXT FIELD, the nextField() method will not skip subsequent instructions so therefore you must return a status in the dialog control instruction that skips other statements.

In a code event that manages a dialog, this can be coded as shown:
CALL dlg.nextField("field_01")
LET dlgCtrlInstruction = libdbappEvents.CONTINUE_DIALOG

For more information on using the nextField() method, see the ui.Dialog.nextField page in Genero Business Development Language User Guide. For examples of use, see dlgEvent_After_EditDialog, dlgEvent_Before_SearchDialog, or dlgEvent_record_AfterInput.