Grid control¶
A grid is a table inside a form: a variable number of rows, each with the same columns. Use it for order lines, list of dependants, or any data that repeats.
Building a grid¶
- Drop a grid on the canvas.
- Add a column for each field, and set the column's type and bound variable.
- Save the form.
Each column behaves like a small control: it has a name, a type, the variable it writes to, and a width. The column widths are stored with the form, so the grid looks the same the next time it opens.
What the grid stores¶
The grid stores rows, and each row is a set of column values. A condition cannot compare the grid with a single value; it compares one cell.
| Where | How to read a cell |
|---|---|
| Server-side condition | @#Items[0]['Price'] — grid, row, column |
| Trigger code | The grid arrives as an array of rows |
| Form condition | @#Items.Price — the column, watched as the user works |
Row numbering starts at 0.
Adding and removing rows¶
The user adds a row with the grid's own button and removes the ones they added. An empty row is not the same as a removed row: it still occupies a position, and a condition that reads it gets empty values.
Column variables and global data¶
Grid columns are bound with the same prefixes as any other variable. The grid only reads the variables declared in its columns; the rest of the form's data is not visible inside it. That keeps a grid fast, and it is the reason a column that points to a misspelled variable stays empty.
In a case¶
- The grid is stored with the case and appears in the change log like any other value.
- In a generated document the rows are printed as a table; see Output documents.
- When the user returns to a step, the grid shows the rows already stored.
Related¶
- Controls — the catalogue.
- Conditions — reading one cell.
- Control properties — column settings.