Field definition for Dynamic Dialogs
Dynamic dialog creation methods require field definitions in a dynamic array with a predefined structure.
Dynamic dialog creation methods such as ui.Dialog.createInputByName()
require a dynamic array as parameter, to
define the list of fields that the dialog will control.
This parameter must be defined as a
DYNAMIC ARRAY OF RECORD
, with
name
and type
members declared as
STRING
:DEFINE fields DYNAMIC ARRAY OF RECORD
name STRING,
type STRING
END RECORD
The names provided in the field definition list must identify
form fields of the current form. The field names can be specified with or without prefix. When a
field prefix is used, it must match one of the screen record definitions in the form file. If no
SCREEN RECORD
is explicitely defined for these fields in form file source, a
default screen record with the name of the database table (or "formonly") is available.For example, if the current form file defines the following
fields:
LAYOUT
...
END
TABLES
customer
END
ATTRIBUTES
EDIT f1 = customer.cust_id;
EDIT f2 = customer.cust_name;
...
END
The field names can be defined as follows:
LET fields[1].name = "customer.cust_id"
LET fields[2].name = "customer.cust_name"
...
The types provided in the field definition list will identify the data type to be used for data input and display.
Possible values for types are the string equivalents of the Genero BDL built-in types, for
example:
"INTEGER"
"VARCHAR(50)"
"DATE"
"DECIMAL(10,2)"
"DATETIME YEAR TO FRACTION(5)"
Note: The type used to define form fields can be the returning value of a
base.SqlHandle.getResultType()
method.For example:
DEFINE fields DYNAMIC ARRAY OF RECORD
name STRING,
type STRING
END RECORD
DEFINE d ui.Dialog
OPEN FORM f1 FROM "custform"
DISPLAY FORM f1
LET fields[1].name = "customer.cust_id"
LET fields[1].type = "INTEGER"
LET fields[2].name = "customer.cust_name"
LET fields[2].type = "VARCHAR(50)"
...
LET d = ui.Dialog.createInputByName(fields)
...