Data Change Alerts
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/ORlogic
If the Expression evaluates to true, the Alert fires.
- 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)
- Warning (GitHub Stars Column) - a simple comparison:
- Each Alert displays a Notification and highlights the cell
- Edit GitHub Stars in any row to a value below 1000
- Edit a row where
language = TypeScriptso GitHub Stars becomes an even number - Clear the value of any text cell (e.g. Language or License)
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,
},
},
],
},
};Each definition needs Scope (where edits are watched), Rule (boolean expression), and MessageType.
Use ColumnIds, DataTypes, or { All: true } in Column Scope.
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)).
Common properties include DisplayNotification, HighlightCell, JumpToCell, and LogToConsole — see Alert Behaviours.
Find Out More
The AdapTableQL Guide provides full details on writing Boolean Expressions