ui.Dialog.createDisplayArrayTo

Creates a new ui.Dialog object to handle a DISPLAY ARRAY.

Syntax

ui.Dialog.createDisplayArrayTo(
   fields DYNAMIC ARRAY OF RECORD
                        name STRING,
                        type STRING
                    END RECORD,
   tabname STRING )
  1. fields is the list of form fields controlled by the dialog. This must be a DYNAMIC ARRAY of a RECORD structure, with a name and type member of type STRING.
  2. tabname is the name of the screen array (defined with the SCREEN RECORD instruction in form files).

Usage

The ui.Dialog.createDisplayArrayTo() class method creates a new dialog object to implement the equivalent of a static DISPLAY ARRAY TO block.
Note: The current form will be attached to the new created dialog.
The method takes a list of field definitions as first parameter. This parameter must be defined as a DYNAMIC ARRAY OF RECORD, with name and type members:
DEFINE fields DYNAMIC ARRAY OF RECORD
                        name STRING,
                        type STRING
              END RECORD
These names provided in the field definition list must identify form fields defined in the current form. 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 provided to the createDisplayArrayTo() method must 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.
The second parameter passed to the createDisplayArrayTo() method is the name of the screen record which groups the fields together, for the list view of the form. For example, in the next form definition, the screen record name is "sr_custlist":
...
INSTRUCTIONS
SCREEN RECORD sr_custlist
(
 customer.cust_id,
 customer.cust_name,
 ...
);
END

For more details, see Screen records.

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.createDisplayArrayTo(fields, "sr_custlist")
...