Conditions

Conditions let you control report generation and distribution on a data basis. You can add multiple conditions to any report or task. Reports are generated and tasks are run only when all their conditions are satisfied. Each condition can be composed of one or more rules.

Nota: If an error occurs during report condition evaluation (before results are produced), the error is reported to the user in the same way as errors that occur during report generation. Both will result in an error message added to the emails sent to users.

The possibility to send reports on a conditional basis has many advantages. For example, you can be informed when key events in the data happen or you can save computational resources by avoiding distribution of unnecessary reports.

A condition is a set of one or more expressions with one or two operands and one operation. Operands can be fixed values, variables or expressions. A condition is associated with an app while the rules within the condition will be bundled to a specific connection of the app.

Conditions affect when filters are applied. If you apply a condition to a task:

  • If there is a task filter, the filter will be applied when evaluating the condition.
  • If there is a report or user filter, the filter will not be applied when evaluating the condition.

If you apply a condition to a task report, task, report, and user filters are always applied when evaluating the condition.

Conditions are supported by both QlikView and Qlik Sense connections. Only the object types that appears in the list during conditions creation can be used.

Conditions could be applied to publish tasks or to publish task reports when adding them to the task. This approach will ensure more flexibility and will allow you to create and manage reports with data from multiple QlikView documents or Qlik Sense apps in a consistent way since filters, reports and conditions manage multiple connections at the same time. For example, you can distribute a sales report with data from different QlikView documents, select the same year on all documents by applying a filter and add a condition that checks whether all the charts of the different documents have data.

There are two types of conditions that can be created using this feature:

  1. Compare the value of an existing QlikView variable with another variable, an expression or a constant value. Available comparisons are: equal to, not equal to, greater than, greater than or equal to, less than, less than or equal to.
  2. Check that a certain QlikView chart contains values at run time.

Create a condition

  1. Click Apps, then select Conditions.
  2. Click on the Create condition button in the upper right corner to start the creation of a new condition.

Enter basic parameters

  1. Enter a descriptive Name.
  2. Enter a Description (optional)
  3. Open the App drop-down menu and select the app in which you want to create the new condition.
  4. Leave the Enabled check box selected.

  5. Click on Create to store the condition in the repository .

Add a rule

  1. Click on the Rules button.
  2. Click on the Add rule button in the upper left corner.
  3. Enter a descriptive Name.
  4. Select a connection by opening the Connection drop-down menu.
  5. The Values section of the page will appear.

Set chart-based conditions

Set your conditions in the Values section. You can create conditions that check if a chart has or has no values. Before starting, be sure that the charts are available in the QlikView document and that the related connection cache is updated.

  1. Select Chart (it is the default value) from the first column on the left.
  2. Select the chart from the central drop-down menu. You can use the Search form to filter the list.
  3. Choose a condition between has values and has no values. The condition has values is true when the chart contains values with the filters applied at the moment of the evaluation of the condition.
  4. Click on Create to store the rule in the repository.
  5. To add anther rule, click the plus symbol, or click Add condition.

Set variable-based conditions

You can create conditions that compare a QlikView variable with another variable, the result of an evaluated expression or a fixed value. Before starting, be sure that the variables are available in the QlikView document and that the related connection cache is updated.

  1. Select Variable from the first column on the left.
  2. Select a QlikView variable from the Select variable drop-down menu.
  3. Choose the relational operator from the drop-down menu.
  4. Select the type to compare:
    1. Variable. Select the second variable from the drop-down menu on the right.
    2. Expression. Insert a QlikView expression that will be evaluated before the comparison. The expression must return a single value.
    3. Constant. Type a constant. No evaluation will be done.
  5. Click on Create to store the rule in the repository.
  6. To add anther rule, click the plus symbol, or click Add condition.

Add conditions to a task

Nota:

If there is a report or user filter, the filter will not be applied when Qlik NPrinting evaluates conditions added to a task.

Do the following:

  1. Open the task you want to add the condition to.
  2. Click on the Conditions button on the upper right area of the screen.
  3. The list of conditions applied to the task will appear.
  4. Click on the Add condition button on the right.
  5. Select the condition from the Choose condition drop-down menu by clicking on the condition name.
  6. You can reduce the list by using the Search form.
  7. Select True or False in the Expected result drop-down menu. If you select True the task will be executed when the condition is verified. If you select False the task will be executed when the condition is not verified.
  8. Click on Add condition to confirm and exit.
  9. The added condition appears at the end of the list.
  10. To add another condition click on Add condition again. You can add as many conditions as you want.

Add condition to report in a task

You can add conditions only to reports already inserted into tasks. It is not possible to add conditions directly to reports. A report is generated only if related conditions are satisfied.

Do the following:

  1. Open the Publish task.
  2. Open the Reports list, then add the report you want to apply conditions to or open it if it is in the list.
  3. Select the condition you want to apply from the Condition drop-down menu in the bottom of the page.
  4. Select True or False in the Expected result drop-down menu. If you select True the report will be created when the condition is verified. If you select False the report will be created when the condition is not verified. This is useful because, for example, you can add two different report with the same condition and set one true and the other false. So if the condition is satisfied the first report will be distributed, otherwise the second report will be distributed.
  5. To add anther condition, click the plus symbol, or click Add condition. You can add how many conditions you want.
  6. Store on the repository by clicking Save.

Remove a condition

You can delete conditions from the main Conditions window, or from the window of the condition itself.