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.

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

Overview

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. Only the object types that appears in the list during conditions creation can be used.

There are two places that a condition may be applied:

  • Publish task report
  • Publish task

Sending reports on a conditional basis has many advantages. For example, you can be informed when key events in the data happen. You can save computational resources by not distributing unnecessary reports.You can 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:

  • 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.
  • Check that a certain QlikView chart contains values at run time.
  • 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 in the different documents have data.

Conditions and filters

Publish task report conditions and publish task conditions affect when filters are applied.

When you apply a condition to the publish task via the Conditions button:

  • If you have applied a task filter, this filter will be applied when evaluating the condition.
  • If you have applied a report filter or user filter, the filter will not be applied when evaluating the condition.

When you apply a condition to a publish task report:

  • Task filters, report filters, and user filters are always applied when evaluating the condition.

If section access is enabled, task conditions are evaluated with the identity set for the connection in the connections page. Report conditions are evaluated using the identity of the recipient of the report.

If you cycle reports that contain conditions and filters, they will be evaluated in this order: Task filter > user filter > report filter > condition. Conditions are not evaluated separately for each report in the cycle. For example:

  1. You have a report filter: YEAR 2012, 2013.
  2. Add a cycle on YEAR.
  3. Add a report condition (evaluated with the filter applied).
  4. Execution flow is as follows:
    1. YEAR 2012, 2013 filters are applied.
    2. Condition is evaluated.
    3. If the condition is met, a report is produced for YEAR 2012, and one is produced for YEAR 2013.

Limitations

If a chart used in the condition is deleted from the document, you will receive a warning message on the condition rule page. Invalid conditions used on tasks cause generation failures. If an invalid condition is applied to a task, the task fails immediately. If it is used as a report condition, only the related reports generation fails.

Evaluation of a condition will be bypassed when an invalid filter is used on a report task. A failure in condition evaluation is treated like a failure in report generation and a generic email containing an error message will be sent.

Creating a condition

Before you create a new condition, you should make sure that any related connection caches are up-to-date.

  1. Click Apps, then select Conditions.
  2. Click on the Create condition button in the upper right corner.
  3. Enter a descriptive Name.
  4. Enter a Description (optional).
  5. Open the App drop-down menu and select the app in which you want to create the new condition.
  6. Leave the Enabled check box selected.

  7. Click on Create.

Adding 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. Open the Connection drop-down menu, and choose a connection.
  5. The Values section of the page will appear.

Setting chart-based conditions

You set your conditions in the Values section. You can create conditions that check if a chart has or does not have certain values. Make sure that the charts are available in the QlikView document or Qlik Sense app.

  1. Select Chart 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.
  5. To add another rule, click the plus symbol, or click Add condition.

Setting variable-based conditions

You can create conditions that compare a QlikView or Qlik Sense variable with another variable, the result of an evaluated expression, or a fixed value. Make sure that the variables are available in the QlikView documentor Qlik Sense app..

  1. Select Variable from the first column on the left.
  2. Select a 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 an 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.
  6. To add anther rule, click the plus symbol, or click Add condition.

Adding conditions to a task

Note:

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. In the main menu, go to Tasks > Publish tasks, and open the task you want to edit.
  2. Click on the Conditions button in the upper right 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.
  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 new 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.

Adding condition to a report in a task

You can add conditions to reports already inserted into tasks. It is not possible to add conditions directly to reports. A report is generated only if all 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 you can add two different reports 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.
  6. Click Save.

Removing a condition

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

Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?