DataTable part in EGL source format
You declare a dataTable part in an EGL file, which is described in EGL projects, packages, and files. This part is a primary part, which means that it must be at the top level of the file and must have the same name as the file.
A data table is related to a program by the program's use declaration or (in the case of the program's only message table) by the program's msgTablePrefix property. A data table is related to a page handler by the page handler's use declaration.
An example of a dataTable part is as follows:
DataTable myDataTablePart type basicTable { { shared = yes } myColumn1 char(10); myColumn2 char(10); myColumn3 char(10); { contents = [ [ "row1 col1", "row1 col2", "row1 " + "col3" ] , [ "row2 col1", "row2 col2", "row2 " + "col3" ] , [ "row3 col1", "row3 col2", "row3 col3" ] ] } endThe syntax diagram for a dataTable part is as follows:
- DataTable dataTablePartName ... end
- Identifies the part as a data table and specifies the part name. For the rules of naming, see Naming conventions.
- basicTable (the default)
- Contains information that is used in the program logic; for example, a list of countries and related codes.
- matchInvalidTable
- Is specified in the validatorTable property of a text field to indicate that the user's input must be different from any value in the first column of the data table. The EGL run time acts as follows in response to a validation failure:
- Accesses the table referenced in the validatorTable property
- Retrieves the message identified by the item-specific validatorTableMsgKey property
- Displays the message in the field identified in the form-specific msgField property
- matchValidTable
- Is specified in the validatorTable property of a text field to indicate that the user's input must match a value in the first column of the data table. The EGL run time acts as follows in response to a validation failure:
- Accesses the table referenced in the validatorTable property
- Retrieves the message identified by the item-specific validatorTableMsgKey property
- Displays the message in the field identified in the form-specific msgField property
- msgTable
- Contains run-time messages. A message is presented in the following circumstance:
- The table is the message table for the program. The association of table to program occurs if the program property msgTablePrefix references the table prefix, which is the first one to four characters in the name of the data table. The rest of the name is one of the national language codes in the next table.
Language National language code Brazilian Portugese PTB Chinese, simplified CHS Chinese, traditional CHT English, uppercase ENP English, USA ENU French FRA German DEU Italian ITA Japanese, Katakana (single-byte character set) JPN Korean KOR Spanish ESP Swiss German DES - The program retrieves and presents a message by one of two mechanisms, as described in sysLib.displayMsgNum and sysLib.validationFailed.
- rangeChkTable
- Is specified in the validatorTable property of a text field to indicate that the user's input must match a value that is between the values in the first and second column of at least one data-table row. (The range is inclusive; the user's input is valid if it matches a value in the first or second column of any row.) The EGL run time acts as follows in response to a validation failure:
- Accesses the table referenced in the validatorTable property
- Retrieves the message identified by the item-specific validatorTableMsgKey property
- Displays the message in the field identified in the form-specific msgField property
- alias
- A string that is incorporated into the names of generated output. If you do not specify an alias, the dataTable-part name is used instead.
- shared
- Indicates whether the same instance of a data table is used by multiple programs in the same run unit. Valid values are yes and no (the default). If the value of shared is no, each program in the run unit has a unique copy of the data table.
The property indicates whether the same instance of a data table is used by every program in the same run unit. If the value of shared is no, each program in the run unit has a unique copy of the data table.
Changes made at run time are visible to every program that has access to the data table, and the changes remain until the data table is unloaded. In most cases, the value of the resident property (described later) determines when the data table is unloaded; for details, see the description of that property.
- resident
- Indicates whether the data table is kept in memory even after every program that accessed the data table has ended.
Valid values are yes and no. The default is no.
If you set the resident property to yes, the data table is shared regardless of the value of shared.
The benefits of making a data table resident are as follows:
- The data table retains any values written to it by programs that ran previously
- The table is available for immediate access without additional load processing
A resident data table remains loaded until the run unit ends. A non-resident data table, however, is unloaded when the program that uses it ends.
Note: A data table is loaded into memory (if necessary) at a program's first access, and not when the EGL run time processes a use declaration.
- contents
- The value of the data table cells, each of which is one of the following kinds:
- A numeric literal
- A string literal or a concatenation of string literals
The kind of content in a given row must be compatible with the top-level structure items, each of which represents a column definition.
- structureItem
- A structure item, as described in Structure item in EGL source format.
Related concepts
DataTable part
EGL projects, packages, and files
Run unit
Related reference
Naming conventions
Structure item in EGL source format
sysLib.displayMsgNum
sysLib.validationFailed
Use declaration