Data Change Alerts

View as Markdown

Summary

  • The most common type of Alert in AdapTable is one which fires as the result of a Data Change rule
  • This Data Change rule is a Boolean Expression - enabling multiple cell values to be included in the evaluation

Data Change Alerts are the most common type of Alert in AdapTable.

They fire whenever a change in the Grid's data matches the Rule in the Alert Definition.

Note

This change can be either the result of a user's edit or of ticking data

Rule

The Data Change Alert Rule is a (Boolean) Expression.

This is evaluated by AdapTableQL - AdapTable's native Query Language.

Note

  • As the Rule is a full Expression, Alerts can fire based not just on the changed cell but other values in the same row
  • And the Rule can combine multiple clauses with AND / OR logic

If the Expression evaluates to true, the Alert fires.

Hint

  • An Expression with a Scope of All (i.e. the whole row) is evaluated whenever any cell in the row is edited
  • Specifying a limited Scope of a few ColumnIds will restrict the edits that potentially trigger the Alert
Alerts: Boolean Expressions
Fork
  • This example provides 3 Data Change Alerts, each firing on a different kind of Expression:
    • Warning (GitHub Stars Column) - a simple comparison: [github_stars] < 1000
    • Success (whole row) - multiple clauses combined with AND: [github_stars] % 2 = 0 AND [language] = "TypeScript"
    • Info (all text Columns) - a function using the in-scope Column: IS_BLANK($SCOPE)
  • Each Alert displays a Notification and highlights the cell
Try It Out
  • Edit GitHub Stars in any row to a value below 1000
  • Edit a row where language = TypeScript so GitHub Stars becomes an even number
  • Clear the value of any text cell (e.g. Language or License)
Loading demo…
Developer Guide

Providing Data Change Alerts in Initial State

const initialState: InitialState = {
  Alert: {
    AlertDefinitions: [
      {
        Name: 'alert-github-stars',
        MessageType: 'Warning',
        MessageHeader: 'Low GitHub Stars',
        Scope: {
          ColumnIds: ['github_stars'],
        },
        Rule: '[github_stars] < 1000',
        AlertProperties: {
          HighlightCell: true,
          DisplayNotification: true,
          JumpToCell: true,
        },
      },
      {
        Name: 'alert-typescript-even-stars',
        MessageType: 'Success',
        Scope: {
          All: true,
        },
        Rule: '[github_stars] % 2 = 0 AND [language] = "TypeScript"',
        AlertProperties: {
          HighlightCell: true,
          DisplayNotification: true,
          LogToConsole: true,
        },
      },
    ],
  },
};
1
Add AlertDefinitions under Alert Initial State

Each definition needs Scope (where edits are watched), Rule (boolean expression), and MessageType.

2
Set Scope to columns, data types, or the whole row

Use ColumnIds, DataTypes, or { All: true } in Column Scope.

3
Write a boolean Rule

The rule can reference the changed cell and other columns in the same row (e.g. comparisons, AND / OR, functions such as IS_BLANK($SCOPE)).

4
Configure AlertProperties (optional)

Common properties include DisplayNotification, HighlightCell, JumpToCell, and LogToConsole — see Alert Behaviours.

Find Out More

The AdapTableQL Guide provides full details on writing Boolean Expressions