Investment Studio > Objects > Grid > Customizing > Record fields > Editor

Grid objects are database viewers and editors. In a Grid with rowwise (columnwise) orientation, each row (column) corresponds to a record in a database; each cell in the row (column) corresponds to a field in the record. All records in a Grid object have the same structure, determined by the Grid's record definition.

By editing a Grid object's record definition, you can modify the number of cells in each row (column), their order of appearance and their contents. To do so, you use the Grid object's record definition editor:

Nothing you do in the editor will affect the Grid object until you click Apply (apply changes and keep editing) or OK (apply changes and close editor). If you make some changes and then decide to discard them, close the editor by clicking the button in its upper right corner. This causes all changes made since the last Apply to be lost.

Record definition editor topics:

The record table
Managing fields
Formatting cells
See also the sections on data types and expressions.

The record table

The record definition editor's centerpiece is the record table. Each row in the table describes a record field. The row's position in the table determines the field's position in the Grid object.

As far as the editor is concerned, the Grid object's orientation (rowwise or columnwise) is irrelevant: the editor's orientation is always rowwise, i.e. record fields always map to rows in the record table.

The most important column in the record table is the third one (Definition): this is where you define the values of record fields, usually by writing expressions in a spreadsheet-like form.

The exception is input fields, i.e. fields which get their value from the user. The Definition of an input field may be left blank. Alternatively, it can be used to specify a default value. In the absence of an explicit default declaration, the default value is determined by the data type of the field (0 for numerical data, "" for string types).

Input fields are easy to spot, since their first three columns are drawn with a red background.

Example: in the screenshot above, the top row describes an input field with no explicit default value.

The second column (Header) contains the field descriptions (plain text strings) displayed in the Grid. If the Grid's layout is rowwise, field headers end up in the Grid's leftmost non-scrolling column. If the Grid's layout is columnwise, field headers end up in the Grid's topmost non-scrolling row.

The first column (Symbol) is used to assign names to record fields. This allows expressions in other fields of the same record to refer to the values of the named fields.

Example: in the screenshot above, the field in the last visible row (header "Change") is defined as the difference between the values of the fields called "_NAV" and "_PREV_NAV". The leading "_" (underscore) in the field names is not mandatory, just a recommended convention used to differentiate symbols from built-in identifiers (e.g. function names).

Symbols can contain any alphanumeric character (letters A through Z, numbers 0 through 9) and are not case sensitive (i.e. "_SYMBOL" and "_symbol" are considered identical).

Named input fields with immediate data types work as custom properties. They extend the portfolio, asset or transaction table connected to the Grid with extra fields.

Example: in the screenshot above, the field called "_COLOR" is a custom portfolio property. The portfolio table has no built-in color property, but each portfolio can nevertheless have its own color code thanks to this custom property.

The fourth column (Format test) allows you to enter actual values for each field and see how they would be displayed in the Grid. Formatting options can be modified using the record table's pop-up menu or the controls in the toolbar.

You can resize rows and columns in the record table by dragging the borders between cells. This has no effect on cell sizes in the Grid object.

Managing fields

Use the following toolbar controls to manage record fields:

Edit as text. Opens a window with an alternate representation of the record table: plain text (no cells) with field columns separated by tab characters. Quicker to edit than the regular spreadsheet-style form when dealing with large definitions and/or long expressions, and particularly handy when you need to transfer a whole section of a record table (just copy and paste).

Note however that the text representation does not include cell formatting information, so that usually has to be adjusted separately (see below).

New. Creates a new field, inserts it below the selected field and selects it for editing.
Delete. Deletes the selected field. Note that disabling it may be a better idea.
Move up. Moves the selected field up in the table (and hence in the Grid object's display order).
Move down. Moves the selected field down in the table (and hence in the Grid object's display order).
Field type. Displays and modifies the selected field's data type.
Disabled. When this button is depressed, the selected row is ignored; as far as the Grid object is concerned, it might as well have been deleted. The advantage over actual deletion is that all settings are still available and the field can be reinstated at the click of a button.

Disabled fields are easy to spot in the record table, since the first three columns in their rows are drawn with a black background.

Example: in the screenshot above, the fourth row is disabled.

This field property can also be toggled using the Disabled item in the record table's pop-up menu.

Hidden. When this button is depressed, Grid cells corresponding to the selected field are hidden. Their values are computed as usual and may be accessed through the field's symbol, but the cells themselves are not visible.

Hidden cells are useful for holding intermediate results needed in the computation of other cell values. On the other hand, a hidden cell field not referenced by other fields is just a waste of computer resources and should be disabled or deleted instead.

Hidden cell rows are easy to spot in the record table, since their first three columns are drawn with a dark gray background.

Example: in the screenshot above, the second row from the bottom is hidden.

This field property can also be toggled using the Hidden item in the record table's pop-up menu.

Formatting cells

Use the following toolbar buttons to modify the formatting of Grid object cells:

Read only. When this button is depressed, the selected field is read only, i.e. the corresponding cells in the Grid object do not allow user input. New fields are read only by default.

Input fields, i.e. fields which do allow user input in the corresponding Grid object cells, are easy to spot in the record table, since their first three columns are drawn with a red background.

Example: in the screenshot above, the top row describes an input field.

This field property can also be toggled by clicking the Read only item in the record table's pop-up menu.

Fixed. When this button is depressed, the Grid object cells corresponding to the selected field will be non-scrolling, provided that the Grid object is set up to display fixed fields.

When a field is fixed, all fields preceding it in the record table are fixed too. This is because (1) row positions in the record table determine field positions in the Grid object and (2) non-scrolling cells are always adjacent to the Grid object's borders, i.e. they can not be preceded by scrolling cells. For the same reason, un-fixing a field also un-fixes all fields below it in the record table.

Note that non-scrolling cells can not be edited, regardless of the field's read only setting.

This field property can also be toggled by clicking the Fixed item in the record table's pop-up menu.

Colors. Click this button to open the background color menu:

In the menu, click Default to open a standard Windows color selection dialog which lets you set the default background color for the Grid object cells corresponding to the selected field.

If the field's data type is numerical, you can use the Conditional submenu to select a second background Color, to be used instead of the default color when cell values cross the specified Threshold:

In the picture, the conditional background color is used when cell values are less than 0.

To disable conditional coloring, simply set conditional color = default color.

The conditional color threshold also acts as conditional font threshold (see below).

Default and conditional background colors can also be set using the Default and Conditional submenus of the record table's pop-up menu.

Fonts. Click this button to open the cell font menu:

In the menu, click Default to open a standard Windows font selection dialog which lets you set the default font for the Grid object cells corresponding to the selected field.

If the field's data type is numerical, you can use the Conditional submenu to select a second Font, to be used instead of the default font when cell values cross the specified Threshold:

In the picture, the conditional font is used when cell values are less than 0.

To disable conditional font selection, simply set conditional font = default font.

The conditional font threshold also acts as conditional color threshold (see above).

Default and conditional fonts can also be set using the Default and Conditional submenus of the record table's pop-up menu.

Trailing text. If the field's data type is numerical, clicking this button will open the Trailing text dialog, where you can specify a string to be appended after the cell's value, e.g. a "%" character:

This dialog can also be opened by clicking the Trailing text... item in the record table's pop-up menu.

Max decimals. If the field's data type is numerical, clicking this button will open the max decimals pop-up menu, where you can set the max number of decimals to display in Grid object cells corresponding to the selected field:

If Pad is checked, values requiring fewer than max decimals will be right-padded with 0s (useful for making values in adjacent rows line up, especially if cells are right-aligned).

This menu is also available under Decimals in the record table's pop-up menu.

Bottom aligned. When this button is depressed, the values of Grid object cells corresponding to the selected field are displayed aligned to the bottom of their cell. If Top aligned is also depressed, cell values are displayed vertically centered.

Cell value alignment can also be set in the Alignment submenu of the record table's pop-up menu.

Top aligned. When this button is depressed, the values of Grid object cells corresponding to the selected field are displayed aligned to the top of their cell. If Bottom aligned is also depressed, cell values are displayed vertically centered.

Cell value alignment can also be set in the Alignment submenu of the record table's pop-up menu.

Right aligned. When this button is depressed, the values of Grid object cells corresponding to the selected field are displayed aligned to the right border of their cell. If Left aligned is also depressed, cell values are displayed horizontally centered.

Cell value alignment can also be set in the Alignment submenu of the record table's pop-up menu.

Left aligned. When this button is depressed, the values of Grid object cells corresponding to the selected field are displayed aligned to the left border of their cell. If Right aligned is also depressed, cell values are displayed horizontally centered.

Cell value alignment can also be set in the Alignment submenu of the record table's pop-up menu.