Skip to main content

Prototyping: A Key to Mock Data Testing

To begin, it is necessary to create a file with a .set extension, which will contain the script for data generation. Prototypes can contain data in both tabular (EXB) and tree (TRE) formats, depending on the target component.

Matrix Prototype​

The first line of the script must define the table name.

::TBL Nam="<table-name>"

Next, we need to define the columns. This is done using ::COL, with the following attributes:

  • Cod: Specifies the column's code or identifier.
  • Txt: Indicates the name of the column that will be displayed.
  • Lun: (Optional) Specifies the length we would like to set for the column.
  • Ogg: (Optional) Defines if the column contains a specific object.
  • Fill: (Optional) Defines the key column should always be associated with an object's id.
  • IO: (Optional) Specifies the visibility of a column and can be configured as O(output), I(input), or B(both).
::COL Cod="<column-code>" Txt="<column-text>" Lun="08" Ogg="<obj-code> Fill="K01" IO="B"

Obviously, our data needs to be populated with rows. We can add rows using ::DAT Fld="<row-content>". It is essential that the data in each row is separated by a | to indicate the transition between one column and another. In the case of empty cells, the | symbol should still be used to maintain the structure.

::DAT Fld="<col1>|<col2>||<col3>"
Example
::TBL Nam="EmployeeData"
::COL Cod="ID" Txt="Identifier" Lun="10" Ogg=""
::COL Cod="Name" Txt="Full Name" Lun="50" Ogg=""
::COL Cod="Age" Txt="Age" Lun="03" Ogg=""
::COL Cod="Email" Txt="Email Address" Lun="100" Ogg=""
::DAT Fld="1|John Doe|30|john.doe@example.com"
::DAT Fld="2|Jane Smith|25|jane.smith@example.com"
::DAT Fld="3|Samuel Green|40|samuel.green@example.com"
::DAT Fld="4|Emily Johnson|22|"
::DAT Fld="5|Michael Brown||michael.brown@example.com"

Tree Prototype​

A tree prototype must have a descriptive name too, and you can optionally specify the type of data it returns using the Com="TRE" attribute.

::TBL Nam="<table_name>" Tit="<table_title>" Com="TRE"

Unlike EXB-type prototypes, there is no need to specify columns for tree prototypes. Each node will include the corresponding obj(t;p;k) and a description.

::DAT Tip="<type>" Par="<parameter>" Cod="<code>" Txt="<Description>"
Example

This example demonstrates a prototype connected to a TRE component that generates a menu. When a menu item is clicked, the corresponding function in the Exec is invoked.

::TBL Nam="MNU" Tit="Colleagues" Com="TRE"
::DAT Tip="CN" Par="COL" Cod="COLL1" Txt="Kingsley Shacklebolt" Exec="F(EXD;*SCO;) 2(MB;SCP_SCH;SCH01)"
::DAT Tip="CN" Par="COL" Cod="COLL2" Txt="Nymphadora Tonks" Exec="F(EXD;*SCO;) 2(MB;SCP_SCH;SCH02)"
::DAT Tip="CN" Par="COL" Cod="COLL3" Txt="Xenophilius Lovegood" Exec="F(EXD;*SCO;) 2(MB;SCP_SCH;SCH03)"