Relative Change Alerts
Summary
- Relative Change Alerts evaluate based on the nature of the data change in a Cell’s value
- They can respond to any change, a relative change or an absolute change
Relative Change Alerts are similar to Data Change Alerts, but they evaluate on the relative nature of the change made to a given Cell's value.
In the Alert Wizard they are a first-class Alert Type (Type: 'RelativeChange'). The Rule step uses the Expression Editor (no Query Builder) with toolbar chips for ANY_CHANGE, PERCENT_CHANGE and ABSOLUTE_CHANGE. Column Scope is configured on the Trigger step, the same as Data Change Alerts.
There are 3 Relative Change Expression Functions:
| Function | When Alert is Triggered |
|---|---|
| ANY_CHANGE | Any change at all to the Cell's value |
| PERCENT_CHANGE | If the value of Cell changes by a given percent amount |
| ABSOLUTE_CHANGE | If the value of Cell changes by a given absolute amount |
Find Out More
See Relative Change Expressions in AdapTableQL for more details
Any Change
Any Any Change Alert fires if there is any change at all to the Cell's value.
It leverages the ANY_CHANGE Expression Function.
- This example displays an Info Alert which fires when there is any change to a Cell's value in any numeric column (using
ANY_CHANGEexpression)
Percent Change
A Percent Change Alert fires if the value of a Cell changes by a given percent amount.
It leverages the PERCENT_CHANGE Expression Function.
Hint
PERCENT_CHANGE can be given a "direction" to limit the evaluation to percent increases or decreases
- This example displays 2 Warning Alerts which check for relative percent changes (leveraging the
PERCENT_CHANGEexpression function)- on the
Github Starscolumn if the cell's value changes by more than 50% (in any direction) - on the
Github Watcherscolumn if the cell's value increases by more than 50%
- on the
Absolute Change
An Absolute Change Alert fires if the value of a Cell changes by a given absolute amount.
It leverages the ABSOLUTE_CHANGE Expression Function.
Hint
ABSOLUTE_CHANGE can be given a "direction" to limit the evaluation to absolute increases or decreases
- This example displays 2 Success Alerts which check for relative absolute changes (leveraging the
ABSOLUTE_CHANGEexpression function)- on the
Github Starscolumn if the cell's value changes by more than 100 (in any direction) - on the
Github Watcherscolumn if the cell's value decreases by exactly 20
- on the
Developer Guide
Providing Relative Change Alerts in Initial State
const initialState: InitialState = {
Alert: {
AlertDefinitions: [
{
Name: 'alert-any-numeric-change',
Type: 'RelativeChange',
MessageType: 'Info',
Scope: {
DataTypes: ['number'],
},
Rule: 'ANY_CHANGE([name])',
AlertProperties: {
DisplayNotification: true,
HighlightCell: true,
},
},
{
Name: 'alert-stars-percent-jump',
Type: 'RelativeChange',
MessageType: 'Warning',
Scope: {
ColumnIds: ['github_stars'],
},
Rule: 'PERCENT_CHANGE([github_stars]) > 50',
AlertProperties: {
DisplayNotification: true,
HighlightCell: true,
DisplaySystemStatusMessage: true,
},
},
],
},
};Set Type: 'RelativeChange' so the Alert Wizard and validation treat the rule as relative change. AdapTable can also infer this from ANY_CHANGE, PERCENT_CHANGE, or ABSOLUTE_CHANGE in the Rule.
Scope limits which column edits are considered (same as Data Change Alerts). The Rule uses relative-change functions on the changing cell.