Edit on GitHub

Table rules

A schema that is used to validate a part of Laboperator workflow templates.

Rules can be leveraged to dynamically change both the behavior and appearance of a table.

When a rule condition is fulfilled, the editable and selectable behavior of cells, rows, columns, or tabs can be set. Likewise, the background color or text color can be changed to visualize a certain state or change of behavior to the user. For example:

  • When a cell number value is negative, change the background color to red.
  • When a cell number value is positive, change the background color to green, make it selectable, but no longer editable.
  • When all cells in a column have no value, the column cells are not selectable or editable across all other tabs of the table.
Array
rangerequired
object

The range of columns, rows and tabs that the rules apply to. Use the mathematical ellipsis notation to define a sequence of successive values from a start point to an end point inclusively. The range is zero-based, meaning its first entity is assigned the index 0. You can specify one or multiple properties to define a selection of cells. Setting only the rows value, for example, would apply a given set of rules to all cells in the defined rows in all tabs. Including the columns and tabs settings would then narrow down that selection.

Examples:
|
range:
  # sequence of 1, 2, 3, 4, 5
  rows: 0,...,4
  # only the fourth column
  columns: 3
columns
string or number
one of
  • string
  • number
string
rows
string or number
one of
  • string
  • number
string
tabs
string or integer
one of
  • string
  • integer
string
condition
reference
Script

A script consisting of one or multiple conditions. The context of the script is defined by all fields and tables present in the workflow step, along with the currentRow, currentCell, and currentTab variables with their respective indexes.

applyrequired
object

The changes that are applied to cells, rows and tabs in the range if the condition is fulfilled.

selectable
boolean
editable
boolean
backgroundColor
string

The value must be a valid CSS color value. Theme colors can be applied using the error, warning, success and info keywords. When choosing colors, also consider the default highlight styles of tables for cell and row selection to ensure sufficient contrast.

textColor
string

The value must be a valid CSS color value. Theme colors can be applied using the error, warning, success and info keywords. When choosing colors, also consider the default highlight styles of tables for cell and row selection to ensure sufficient contrast.

hintText
string

The hint text that will be available for the user when the rules are applied.

formatSpecifier
reference
Format Specifier

A format specifier is a string describing how to format a number for display. It is based on the excellent d3-format library. For example, a typical fixed point precision of two digits behind the decimal point is achieved with .2f. Visit their official documentation for a complete reference and examples.

readOnly
boolean
Examples:
>
range:
  # Columns 1 to the last
  columns: 0,...
  # Rows from 4 to 10
  rows: 3,...,9
  # Only first tab
  tabs: 0
condition: |
  myReferenceField.experiments.firstExperiment.density < CELL_VALUE(table, tab, row, column - 1) &&  CELL_VALUE(table, tab, row, column - 1) <= myReferenceField.experiments.secondExperiment.density
apply:
  editable: false
  backgroundColor: rgb(0, 128, 0)
  textColor: rgb(255, 255, 255)
  hintText: I am a hint text
|
range:
  # Columns 1 and 4 to 6
  columns: 0,3,...,5
  # Rows 2 and 4 to 10
  rows: 1,3,...,9
  # Tabs 1 and 5 to 7
  tabs: '0,4,...,6'
apply:
  selectable: true
  editable: true
  backgroundColor: '#FF0000'
  textColor: '#FFFFFF'
range:
  tabs: 2
condition: CELL_VALUE(table, tab, row, column - 1) > myReferenceField.density
apply:
  selectable: true
  editable: true
  backgroundColor: green
  textColor: white
Where is this used?
Other schemas that have a reference ($ref) to this schema.

No references found.