Using the program generator

This section describes all the controls on the program generator screen.


File and program details

Data dict

The full path of the selected data dictionary.

Data dir

The directory in which the data files (index file, and data file if present) are located. This directory is used in the openfile command in the generated program. When a data dictionary is loaded into the program generator, the data directory is determined as follows:

1

If a directory was specified in the command line (-p option) that directory is used.

2

Otherwise, if a data directory is specified on the Configure screen, that directory is used.

3

Otherwise, the data dictionary’s directory is used.

The data directory can be edited. It is not tested for validity; the program will compile but unless the required files are present in the data dictionary it cannot be run.

If the data directory is blank, no directory is specified in the openfile command. e.g.:

openfile FILE_CONTROL name = "control" update

Program name

The name to be given to the source file and compiled object file. The .r extension is automatically added to this name when the source file is created. The compiled program has the same name but with a .q extension. Defaults to the data dictionary name.

Title

The window title for the main window of the generated program. Defaults to the data dictionary name.

Program dir

The directory in which the program files (source code files (.r and .q) are to be created. A default program directory can be specified on the Configure screen. If no default is specified, the default is the directory where the data dictionary resides.


Indexes

If the selected data dictionary has secondary indexes defined, a listbox containing the names of all secondary indexes appears at the top right of the program generator screen. The listbox is for the purpose of selecting the indexes to be used in the generated program. Buttons are provided to select or deselect all indexes. All indexes are selected by default.

If a secondary index is selected for inclusion, the program will include the facility to find a record and sequence searches by that index, to position it at the start or end, and to display a list of all records sorted by that index.


Field table

This table occupies most of the program generator screen. It lists all the fields in the selected data dictionary, one field to each table row.

Row

Acts as a count of fields, but is mainly provided for purposes of single and multiple line selection. See Selecting and deselecting lines in the field table.

Key

Read-only checkbox column, indicating whether the field is a key field. All key fields must be included in the generated program; the Inc column cannot therefore be unchecked for a key field. See Key fields and data fields.

Name

The field’s identifying name. Read-only.

Type & Size

The field’s type and size. Displayed in the form of a string which also contains, if present, the field’s dimensions and logical type. Read-only.

Tab

Only relevant to array fields. Array fields are displayed in tab windows. A packed text field is displayed in a free-format textbox in a tab of its own. Such a field is alphanumeric, with a format string containing the character “p”. Other array fields are displayed in tables, each table in a separate tab. By default, fields are grouped with other array fields of the same dimension, each field forming one column in the table.

The Tab value indicates the tab number in which a field will appear. The default order, displayed when a data dictionary loads, is determined by the order fields are defined in the data dictionary.

By changing tab numbers, it is possible to split fields that would otherwise be grouped in the same table. Allocate an unused tab number to a field and it will appear in that tab on its own. Other fields of the same dimension may be added to the new tab.

The Tab value can also be used to change the order of tabs. For example, if there are currently 5 tabs, numbered 1 to 5, changing tab number 2 to any value greater than 5 would make that tab the last tab. If there was more than one field with tab number 2, all fields would have to be similarly amended unless the fields were to be split into two tables.

When the program is generated, tabs are renumbered downwards if one or more numbers have been omitted.

Heading

The heading defined for the field in the data dictionary. Editable. The heading is used as the label for textboxes displaying the field, and as a heading for the field in reports. If the heading is blank the field Name is used instead. Very long headings should be avoided, since the starting column for textbox positioning is set to accommodate the longest heading.

Format

The format defined for the field in the data dictionary. Editable. If a format is provided it will be applied to textboxes and table columns containing the field, and applied to the field when it is printed.

If the field is a packed text type, indicated by the format character p in the data dictionary format, it is displayed in a free format textbox in a tab window of its own. See Long text fields; Field formats.

Width

Only relevant to alphanumeric fields. Indicates the field width to be used, in characters. Defaults to the field size, but can be edited to a lower figure. Textboxes or table columns containing the field will be generated in a pixel size suitable to accommodate the number of characters specified. If a textbox (including heading) is too wide to fit on the screen the box is truncated.

Report Width

Only relevant to alphanumeric fields that are to be included in the columnar report. (Inclusion is indicated by a check in the Rep column.) Indicates the width, in characters, to be used if the field is included in the columnar report on all records. It is frequently advisable to reduce the width allocated to alphanumeric fields, in order to fit all the fields in one line of the report. The compiled program uses the fit() function, forcing text to fit into its allocated space, where necessary, by reducing the font size.

Caption

Text for a caption to be displayed as a help message when a textbox containing this field has focus. Defaults to the field’s Help text, which appears on the Field details screen in the data dictionary editor. The use of captions in the generated program can be turned off on the Configure screen, in which case this column is not relevant and therefore read-only.

Tooltip

Text for a tooltip to be displayed as a help message when a textbox containing this field has focus. Defaults to the field’s Help text, which appears on the Field details screen in the data dictionary editor. The use of tooltips in the generated program can be turned off on the Configure screen, in which case this column is not relevant and therefore read-only.

Inc

Checkbox column indicating whether the field is to be included in the generated program. Key fields must be included. The Edit menu has options to select or deselect all data fields. A field that is included in a secondary index key, but is not a main index key, can be excluded. It will appear in the generated program only where necessary in Find by Index windows.

Fields are checked by default unless the field name satisfies the following conditions: it begins with “fill”, “filler” or “spare” (case irrelevant) and there are no other characters in the name except the numerals 0-9 and the underscore character. The generator makes an intelligent assumption about the purpose of such fields.

If a set of adjacent fields are to be included or excluded, the fastest method is to select them by means of CLICK and SHIFT-CLICK, then use The right-mouse menu.

List

Checkbox column indicating whether the field is to be included in the List table. This table displays all the records in the file, one per row, in a file-driven table. The user can select a record for display from the list. Clearly, if the file is large the table rapidly becomes very wide, and it is practical to select a limited number of primary, informative fields for the list. The list always displays the first element of subscripted fields.

Rep

Checkbox column indicating whether the field is to be included in the columnar report on all records. In this report each record is printed on one line. This checkbox does not affect the report on the displayed record, which prints all fields.


Selecting and deselecting lines in the field table

Line selection facilitates the repositioning of fields, and also enables multiple fields to be included or excluded as a single operation.

CLICK, SHIFT-CLICK and CTRL-CLICK can be used in the row number column at the far left of the table to select and deselect rows in the standard way:

Clicking the left mouse button selects the current line, deselecting all others.

CLICK and drag the mouse to select a group of consecutive lines.

CTRL-CLICK toggles a line from deselected to selected or vice versa.

SHIFT-CLICK selects the current line and all lines between it and the previously selected line.

Clicking in an editable cell, including checkboxes, automatically deselects all selected fields.

NOTES

  • Key fields cannot be selected, since none of the operations performed on selected fields are applicable to key fields.

  • Although the row number field is provided so that it is available to click on for selection operations, any other non-editable field can be used for the same purpose.

  • Note the difference between a selected field and an included field. A selected field is a field whose row is highlighted. An included field is one with a check in the Inc column.


The right-mouse menu

This menu is opened by a right click on any data field in the table. Key fields cannot be moved or excluded and so the menu does not operate on them. The menu options displayed vary according to whether or not one or more lines are currently selected, and the position of the line clicked on.

If the line is unselected, it is highlighted until the menu closes, using a different colour from that used for selected lines. It remains unselected.

If the line is selected it remains selected, and its colour remains unchanged.

The menu enables the moving of data fields to different positions, thereby changing the order the fields are displayed in the generated program. It also enables the inclusion or exclusion of multiple fields.

Paste selected lines…

Only displayed if one or more lines have been selected. Pastes the selected lines above the line clicked on.

Include selected lines…

Only displayed if more than one line is selected. Changes the state of all selected lines to included, checking the Inc, List and Rec columns.

Exclude selected lines…

Only displayed if more than one line is selected. Changes the state of all selected lines to excluded, unchecking the Inc, List and Rec columns. If Remove excluded fields automatically is checked on the Configure screen, the fields are also removed from display.

Move this line down
Move this line up

Moves the line up or down one row.


Create and Run buttons

Create program

Generates the program and compiles it using the Sculptor compiler scc. If a Directory for generated programs has been specified on the Configure screen, the source file and compiled program are placed there; otherwise they are placed in the same directory as the data dictionary. A warning is issued if the .r file already exists.

Run program

Run the program, using the run time interpreter srepwc. See The compiled program for detailed information on programs generated and compiled by the generator.


RELATED TOPICS

The program generator

The compiled program

Data dictionaries

Data dictionary editor

Data dictionary editor maintable

Data dictionary editor Field detailsscreen