Filters

Filters let you refine your data. You can add filters to tasks, reports, objects, and users. They can be static or dynamic.

Types

Here are a few ways you can use filters:

  • Task: filter a publish task to only share data from the current quarter.
  • Report: filter a report to only display information related to the top 5 sellers.
  • Object: filter a pie chart that details grocery sales to only show fruit sales.
  • User: filter a user group to only see data related to their geographic location.

Static filters are selected from a list of QlikView or Qlik Sense field values. You must manually edit the filter to change values.

Dynamic filters use QlikView or Qlik Sense formulas. Formulas must use QlikView or Qlik Sense rules and syntax, and return a single value. Formulas are evaluated, and the results are used to filter data. You do not have to modify dynamic filters to gain new values.

Filter evaluation

Filters are verified before generating each report. Task, user, and report filters are checked against document data. If they are invalid, you will see an error stating that filters cannot be applied on the Task executions page. This happens before the calculation of report conditions, and before report generation.

If you have a single filter, it is evaluated as follows:

  1. Clear all selections for all fields, with Override values selected.
  2. Evaluate values for each field with formulas.
  3. Apply selections based on values to all fields.

When you have multiple filters, they are evaluated in the following sequence:

  1. All task filters are applied one at time, according to their sort order.
  2. All user filters are applied one at time, according to their sort order.
  3. All report filters are applied one at time, according to their sort order.
  4. All object filters are applied one at time, according to their sort order.

Rules

Qlik NPrinting filter rules provide predictable behavior with a limited number of options.

  • Formulas are evaluated first, in order to have static values to manage.
  • Filters will not necessarily overwrite past selections. There is no strict hierarchy.
  • Each filter will be analyzed in sequence: task -> user -> report -> object.
  • The values of filter fields at different levels will be intersected.
  • If the intersection gives an empty result, the filter chain will become invalid.
  • There is no limit to how many task, report, object, or users filters you can apply in an app. However, only one object filter can be applied to a single object.
  • If the application of a filter results in an impossible selection, a specific error is returned: "Cannot apply filter {0} to current document data. Requested fields with evaluates are: {1}",

There is one specific flag that allows you to change these behaviors: Override values. This flag, which is related to specific fields of a filter, allows you to clear the selections on a certain field on a certain level of the chain. You can also add other values instead.

Examples of filtering results

These examples show filters assigned to specific entities for different values of the same field, with Override values selected or de-selected:

Example 1

  • Task filter: Country = Italy, Spain
  • User filter: -
  • Report filter: Country = Italy, Germany
  • Resulting filter: Country = Italy

Example 2

  • Task filter: Country = Italy, Spain
  • User filter: Override values = Checked for Country
  • Report filter: Country = Italy, Germany
  • Resulting filter: Country =Italy, Germany

Example 3

  • Task filter: Country = Italy, Spain
  • User filter: Country = Italy, Germany
  • Report filter: Override values = Checked for Country
  • Resulting filter: Country = All countries

Example 4

  • Task filter: Country = Italy
  • User filter: -
  • Report filter: Country = Germany
  • Resulting filter: empty

Example 5

  • Task filter: Country = Italy
  • User filter: Override values=True for Country
  • Report filter: Country =Germany
  • Resulting filter: Germany

Selecting values

In the Values drop-down menu you can select from:

  • Value is: use this option if you want to select a string. For example, if you want to select USA in the Country field.
  • Numeric value is: in QlikView and Qlik Sense, all field values are potentially dual values. A field value can have both a numeric value and a textual value. For example, a date that could have a numeric value of 40908 and the textual representation "2011-12-31". Use this option if you want to select a numeric value.
  • Evaluate value: use this option if you want to insert an expression that needs to be evaluated. It must return a single value.

If the Fully cached notification appears on the right, it indicates that the Qlik NPrinting cache contains all values of a field. This means that when you start typing in the Values dialog box, Qlik NPrinting searches all the values that match your string.

The Qlik NPrinting cache only stores the first 1000 values from QlikView fields with a large amount of distinct values. In this case, the Fully cached green label does not appear. You will instead see a Search button on the right side of the value field. Type the string, or part of the string, that you want to find. Click Search to force Qlik NPrinting to look for the string in the connected QlikView document. When there is a large amount of distinct values, you have to manually insert the whole value that you want to filter.

Creating static filters

Do the following:

  1. Select Apps, and then select Filters.
  2. Click Create filter.
  3. Enter a Name for your filter.
  4. Select an app from the App drop-down list.
  5. Click Create to create the report.
  6. Click Fields in the filters menu.
  7. Click Add field.
  8. Under Connection, select your connection.
  9. Under Name, select a field name.

  10. You can choose to Override values: if you select this check box, all selections applied by other filters on the same field will be removed and replaced by the values of the field set in current filter. If Override values is not selected, a new filter will be created by the intersection of field values from different filters applied on the selected field.

    Note: You can clear all selections on a field by creating a filter with empty values for that field and selecting the Override values check box.

Adding values to a field

Do the following:

  1. Choose a value type from the drop-down list:
    • Value is
    • Numeric value is
    • Evaluate value
  2. Depending on the value type, you can choose from a list, start typing a string, or type an expression. See: Selecting values
  3. If you want to add a second value, click Add value.

    A new empty row appears.

  4. Add your second value.
  5. Click Create.

Creating a dynamic filter with formulas

You can use QlikView and Qlik Sense formulas to calculate values to be used in filters. Each formula must return a single value, and use QlikView or Qlik Sense syntax. For example, you can use a formula to calculate the value of the previous year and compare it with the Year field in a filter.

Do the following:

  1. Create a new Filter.
  2. Go to the Values area, and select Evaluate value from the drop-down.

    This option sends your formula to QlikView or Qlik Sense, which will evaluate the result and return it to be used in the filter.

  3. Enter a formula in the Value box.

    For example, to retrieve the value of the last year, enter =Year(now())-1.

  4. You can click Add value to add another formula. Adding many values for the same field creates a logical "OR" association. The filter will keep data that matches one or both values.
  5. Click Create.

Adding filters to a new report

You have to create filters before you can add them to reports, tasks, objects or users. You cannot create a new filter from inside another entity.

Do the following:

  1. Create a new report, or open an existing one.
  2. Click Filters in the main menu.
  3. Select the filters you want from the Available items.
  4. Click Next to move the filters into the Selected Items column.
  5. Click Add filters.

Applying a filter to an object

Object filters are useful when you want to filter a specific table or image. For example, if you have a report with no filters, but you want to add a table that only displays last year's sales, you would apply an object filter.

Objects can only have a single filter. If you need to add a complex filter to an object, you must create a unique filter before you edit the report template.

Do the following:

  1. On the Reports screen, click on your report.
  2. Click the Edit template button to open the Qlik NPrinting Designer template editor.
  3. On the left pane, right-click the type of object you would like to filter, and select Add objects.

    You can filter tables and images.

  4. A new window will open. Select the object you would like to filter, and click OK.
  5. Drag your new object from the left pane to your report template.
  6. On the Properties pane, go to Filters and click the ¥.
  7. A new window will open. Select the filter you would like to use, and click OK.
    Note: If you accidentally pick the wrong filter, you can click the eraser icon next to the ¥ to remove all filters from an object.
  8. Click Preview.

    Your report object will only show information related to the filter.

Importing object filters associated with users

Object filters associated with users are not automatically included in Qlik NPrinting Designer, for performance reasons. Importing all of the filters associated with thousands of users would take a long time, and could cause Qlik NPrinting to stall.

You can change this behavior by editing the webengine.config file.

Do the following:

  1. Open the webengine.config file.
  2. Uncomment the line <!-<add key="include-user-filters" />->.
  3. Close and reopen Qlik NPrinting Designer.
  4. The list of filters will now upload all filters you have stored in the repository.

    This could take a very long time, depending on the number of stored filters.

If you do not want to edit the webengine.config file, you can manually import a specific user filter. There are two ways to do this:

  • Remove the filters association from all users.
  • Create a new filter, not linked to any user, with the same fields and values.

Configuring report behavior

You can configure how a report handles object filter errors for charts and tables in your templates. Open the report, scroll down to Error handling, and select from these two options:

  • Generate report. Invalid content will be replaced with placeholder images.

    Invalid charts are replaced with placeholder images. They have a grey background and black overlay text that says "Invalid selections". These images are scaled according to maximum size settings in your report template. Invalid tables are replaced with empty tables with no overlay text.

  • Do not generate report. Report generation will fail until issue is resolved.

    The entire report will fail to generate. Users will not be able to view it.

In Qlik NPrinting April 2018 and later, the default behavior for new reports is to add placeholder images. If you are using Qlik NPrinting February 2018 or older, and update to a newer version, your reports will keep the pre-existing report failure behavior.

Configuring empty content

Empty content is displayed as placeholder images. They have black overlay text that says "Invalid selections". This overlay text can be changed.

Do the following:

  1. Open the scheduler.config configuration file.
  2. Find the "empty-content-text" tag. Uncomment this line, and edit the value.
  3. Restart the Qlik NPrinting scheduler service.

The change is applied to all empty content placeholder images.

Troubleshooting

The folder containing my cycled reports shows reports with the FAILED label

Possible cause  

Your reports contain incompatibility filters.

Proposed action  

Check the filters associated with the report. For example, you have 2 filters:

  • The first contains → Year: 2012, 2013
  • The second contains → Year: 2014

If you use both filters, the intersection between the filters will produce an empty set.

My reports fail to generate

Possible cause  

Your report uses the same dimension in the task, user, report, and object filter hierarchy.

Proposed action  

Change or remove any filters that use the same dimension.

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?