Instantiate a dynamic dialog
The dynamic dialogs needs to be created with specific ui.Dialog
methods.
Defining the dialog object variable
ui.Dialog
:DEFINE d ui.Dialog
Defining field names and types
The dynamic dialog creation methods take the list of field definitions as parameter, as a dynamic array with a record structure using two members to define the field name and data type.
DEFINE fields DYNAMIC ARRAY OF RECORD
name STRING,
type STRING
END RECORD
The field definition array will identify form fields and the data types to be used to store the values.
LET fields[1].name = "cust_id"
LET fields[1].type = "INTEGER"
LET fields[2].name = "cust_name"
LET fields[2].type = "VARCHAR(50)"
LET fields[3].name = "cust_modts"
LET fields[3].type = "DATETIME YEAR TO FRACTION(5)"
The type names used by the dynamic dialog API is the same as the type names returned by the base.SqlHandle.getResultType()
method.
Instantiate the dynamic dialog object
When the list of field definition is complete, the next step is to create the dynamic dialog object.
When instantiating a dynamic dialog, the current form is automatically attached to it.
-
To create a dynamic dialog handling simple record input (like
INPUT BY NAME
):LET d = ui.Dialog.createInputByName(fields)
For more details, see ui.Dialog.createInputByName.
-
To create a dynamic dialog handling query by example (like
CONSTRUCT
):LET d = ui.Dialog.createConstructByName(fields)
For more details, see ui.Dialog.createConstructByName.
-
To create a dynamic dialog handling a read-only list (like
DISPLAY ARRAY
):LET d = ui.Dialog.createDisplayArrayTo(fields, "sr_custlist")
The
createDisplayArrayTo()
method requires the name of the screen record used to group form fields, as defined in theINSTRUCTIONS
section of the .per form file.For more details, see ui.Dialog.createDisplayArrayTo.
-
To create a dynamic dialog handling an editable list (like
INPUT ARRAY FROM
):LET d = ui.Dialog.createInputArrayFrom(fields, "sr_custlist")
The
createInputArrayFrom()
method requires the name of the screen record used to group form fields, as defined in theINSTRUCTIONS
section of the .per form file.For more details, see ui.Dialog.createInputArrayFrom.
-
To create a dynamic dialog handling a multiple dialog (like
DIALOG / END DIALOG
):LET d = ui.Dialog.createMultipleDialog()
Then add sub-dialogs with methods such as
ui.Dialog.addInputByName
.For more details, see ui.Dialog.createMultipleDialog.