> For the complete documentation index, see [llms.txt](https://docs.xforms.co/xforms-manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xforms.co/xforms-manual/form-controls/table-conrol-tbl.md).

# Table Control (tbl)

## Settings <a href="#attributes" id="attributes"></a>

| Setting       | Value                          | ​Comment                                                                |
| ------------- | ------------------------------ | ----------------------------------------------------------------------- |
| type          | tbl                            |                                                                         |
| id            | string (optional)              | allows access to this control                                           |
| append        | true/false (optional)          | true: Allows to add new rows to the table (default: false)              |
| columns       | array of Columns               | (see below)                                                             |
| data          | array of table Data (optional) | predefined table rows (see below)                                       |
| blankRowCount | number (optional)              | number of blank rows when printing blank form (default 2)               |
| appendText    | string (optional)              | the title of button to add new row to the table. Default "Add new row". |
| footer        | true/false (optional)          | if true, the footer is displayed                                        |

### Column <a href="#column" id="column"></a>

| Attribute    | Value                                          | Comment                                                                                                                                                                                                                                                                                                                                |
| ------------ | ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| header       | string                                         | header text                                                                                                                                                                                                                                                                                                                            |
| id           | string (optional)                              | <p>used for accessing column value in expressions (below)</p><p>also used to access footer value when accessed outside of the table</p>                                                                                                                                                                                                |
| name         | string (optional)                              | footer value name when export form data                                                                                                                                                                                                                                                                                                |
| type         | column type                                    | valid types: txt,num,chk,mch,dat,tim,sig,lnk                                                                                                                                                                                                                                                                                           |
| locked       | true/false (optional)                          | true: column cannot be edited, except for appended rows                                                                                                                                                                                                                                                                                |
| default      | (optional)                                     | the default value of the column in appended rows                                                                                                                                                                                                                                                                                       |
| options      | string (optional)                              | list of options for for multi-choice (mch) columns.                                                                                                                                                                                                                                                                                    |
| required     | true/false (optional)                          | makes the column value required                                                                                                                                                                                                                                                                                                        |
| requiredWhen | string (optional)                              | makes the column value required when certain value is entered in another column. See the notes section below for details.                                                                                                                                                                                                              |
| format       | string (optional)                              | <p>for Date column similar to date control</p><p>for Time column similar to time control</p><p>for numeric column<br>  - "$" for currency<br>  - "%" for percentage</p><p>for Text column:</p><p>  - "lower" for lowercase</p><p>  - "upper" for uppercase</p><p>  - "title" for title-case (capitalize first letter of each word)</p> |
| maxLen       | number (optional)                              | maximum number of character for Text Column                                                                                                                                                                                                                                                                                            |
| width        | number (optional)                              | % width of the column compare to whole table width                                                                                                                                                                                                                                                                                     |
| footer       | string (optional)                              | <p>A string value to display in footer row for the column.</p><p>It also could be an aggregation function:</p><p>"=sum" to show sum of column values in all rows</p><p>"=avg" to show average of column values in all rows</p><p>"=count" to show count of rows</p>                                                                    |
| expression   | string (optional)                              | <p>mathematical expression that uses columns' "name" to generate calculated value.<br>Example: "{fee}\*{qty}\*0.15" in which "fee" and "qty" are names of two columns in same table.</p>                                                                                                                                               |
| noDefault    | true/false (optional)                          | <p>For Time and Date column in new rows: <br>if true, no default value will be set<br>If false, the current date or time will be display in the column</p><p>(if not provided, default values will be displayed)</p>                                                                                                                   |
| link         | string (optional)                              | <p>links the column to another column of "lookup" or "multi-choice" type.</p><p>format: "\<column-id>:\<value-name>". ex: "customer:name"</p>                                                                                                                                                                                          |
| docType      | string (optional)                              | Entity type (for Lookup Control)                                                                                                                                                                                                                                                                                                       |
| lookupItem   | string (optional)                              | Lookup items search box title (for Lookup Control)                                                                                                                                                                                                                                                                                     |
| lookupField  | string (optional)                              | Lookup items field to display in table column (for Lookup Control)                                                                                                                                                                                                                                                                     |
| showTimeZone | <p>true/false (optional)<br>default: false</p> | <p>if true, a time zone name will be displayed next to date and time.<br>example: 05:22 PM (EDT)</p>                                                                                                                                                                                                                                   |

### Data (Rows) <a href="#row" id="row"></a>

| values   | array of values in order (optional) | predefined rows                                                                 |
| -------- | ----------------------------------- | ------------------------------------------------------------------------------- |
| locked   | true/false (optional)               | true: cannot delete the row                                                     |
| hideWhen | expression with true/false          | <p>the table row is hidden if expression is true<br>(see below for details)</p> |

## Notes: <a href="#notes" id="notes"></a>

### Column's requiredWhen <a href="#columns-requiredwhen" id="columns-requiredwhen"></a>

&#x20;It's similar to Expressions with other field IDs in { }

&#x20;Example: ""{changeofownership} == true'" <br>

### Row's hideWhen

Similar to Column's requiredWhen (above). If the expression results a True value, the row will not be shown.
