The easiest way to define an alert is by using the Alert Wizard that can be invoked from the Tools menu.
The Alerts dialog is opened from the Tools menu. This dialog is used for managing alerts, which are stored as part of the QlikView document. Alerts can be triggered from any Windows version of QlikView (that is, not from AJAX clients).
An alert is a composite entity typically consisting of three basic parts:
- A condition that can be either true or false.
- A logical state (bookmark, clear all or current selection state) that should be applied before checking the state of the condition expression.
- One or more actions to be performed when the condition is checked and evaluates to true. Typical actions include showing a message in a pop-up window or sending a message as an e-mail to one or more recipients. Further actions can be programmed via macros.
When an alert is checked and the condition is met and the action(s) performed, it can be said that to have "fired". QlikView alert checks can be triggered in three different ways:
- Automatically in the QlikView layout when there is a probability that the document’s data has changed, i.e. when the document is opened, when the script has been executed or when a Reduce Data operation has been performed.
Manually from a macro via special Automation APIs.Tip: Refer to the QlikView file APIguide.qvw (a very useful QlikView file describing the use of the macro functionality in QlikView, which is normally installed with the program) for details.
- Externally from programs running QlikView in batch mode which have a special Automation API to retrieve a list of fired alerts from a given context.
Use caution when creating alerts, large amounts of macro-triggered alerts can make the document sluggish!
The Alerts Dialog
The top left part of the dialog contains a list of alerts where all alerts currently defined in the document are displayed. The list includes three columns: ID, Enable and Description.
- ID: The unique ID of the alert is displayed in the ID edit box as well as in the list of alerts. Upon creation, every QlikView layout entity, including alerts, is assigned a unique ID for control via a macro. The first alert of a document will be assigned the ID AL01. It is possible to edit this ID number later on in the ID edit box.
- Enable: Select or deselect the check box in order to enable/disable the alert.
- Description: Description of an alert as defined under Description (see below).
- Add: The Add button adds a new default alert to the list for further editing.
- Remove: Selecting an alert and clicking the Remove button deletes it from the list.
- Condition: The Condition
group is used for defining the conditional expression.
- (Condition): This is a QlikView expression that should evaluate to true (non zero) when the alert is to fire.
- All Clear: If this option is checked the all clear state will be used when evaluating the alert condition.
- Bookmark: If All Clear is left unchecked, you may specify a bookmark to be applied before the alert condition is tested. The bookmark should be stated as a bookmark ID. The bookmark must exist for the alert to work properly. If no bookmark is specified and the All Clear check box is left unchecked, the current selections (i.e. the logical state of the document) will be used when the alert condition is tested.
- Events: The Events
group is used for defining automatic event checks.
- On Open: The alert is automatically checked when the document is opened.
- On Post Reload: The alert is automatically checked after a script execution (Reload) of the document. In addition, the alert is also checked upon opening of the document, provided that the last reload time stamp stored in the document is later than the time stamp noted when the alert was last checked.
- On Post Reduce: The alert is automatically checked after a data reduction (Reduce Data command) of the document. In addition, the alert is also checked upon opening of the document, provided that the last reduction time stamp stored in the document is later than the time stamp noted when the alert was last checked.
- Delay: The re-firing of automatically checked alerts may be suspended for a given number of Days after an alert has been fired. Decimals may be used for specifying fractions of a day. The value 0 of course indicates that no delay will be applied.
- Trigger Level: The re-firing of automatically checked alerts may also be suspended on
the basis of whether the alert status has changed after the firing. In
the drop-down list you can choose between three levels of reoccurrence:
- Always: means that the alert is fired every time the trigger event(s) occur and the alert condition is fulfilled.
- Message Changes: means that the firing of the alert is suspended until the alert Message changes. This is of course only meaningful with dynamic message text. (Note that the state of the alert condition does not necessarily have to change in order for the evaluated message to change. Any change in the Mail Subject line (see below) will be regarded as change of message.)
- State Changes: means that the firing of the alert is suspended until the alert state changes, i.e. the alert condition was unfulfilled during at least one check and then becomes fulfilled again during a later check. This is the strongest type of alert suspension.
- Show Popup: Mark the check box Show Pop-up to show the alert message as a pop-up balloon when the alert is fired.
- Use Custom Popup: The Use Custom
Pop-up group lets you define a custom pop-up format for the selected
alert. By checking this alternative, you can replace the default Alert Pop-up Settings as defined in Document Properties: General . The Pop-up Settings
button opens the Pop-up Window Settings dialog.
Pop-up Window Settings
- Mode: In the Mode group you can check the relevant options in order to define an alert as an Interactive (automatic triggers in layout) and/or as an alert relevant for external programs running QlikView in Batch mode (command line execution), e.g. QlikView Publisher, via the special Automation API for Batch triggers. If none of the check boxes in this group are marked, the alert can still be manually checked via macros.
- Description: A commentary field where the creator of an alert can describe the purpose of an alert. It is only used in the list of alerts in this dialog.
- Message: The Message
edit box is where you type the message to be displayed with the alert.
For pop-up alerts the text will appear in the pop-up, for e-mail alerts
this is the body text of the e-mail. The message text may be defined as a calculated formula for dynamic update. Click the ...
button to open the Edit Expression
dialog for easier editing of long formulas.
Expression syntax for calculated formulas
- Mail Subject: In the Mail Subject edit box a text to be used for the subject line in e-mail alert messages can be entered. The text may be defined as a calculated label expression for dynamic update. Click the ... button to open the Edit Expression dialog for easier editing of long formulas. If left empty, the subject line will display the text 'QlikView Alert'.
- Mail Recipients: The Mail Recipients pane is a semi-colon separated list of mail addresses. Each addressee will receive an e-mail message whenever the alert fires. The list may be defined as a calculated string expression for dynamic update.