Filters

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

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. 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 let you select a list of values from QlikView or Qlik Sense fields. 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 rules

Qlik NPrinting filter rules were designed to provide predictable behavior with a limited number of options. When you apply multiple filters on different entities during report creation:

  • Filters are evaluated in the following sequence: task, user, report, and object.
  • Filter will not necessarily overwrite past selections. There is no strict hierarchy.

Evaluation flow in case of single filter application:

  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.

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.

Filter application order:

  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

  • Formulas will be evaluated first in order to have static values to manage.
  • 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.
  • If the application of a filter results in an impossible selection, a specific error is returned.
  • 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

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

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

 

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

 

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

 

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

 

  • 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 the string that you type.

The Qlik NPrinting cache does not store all values from QlikView fields when there is 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.

The Qlik NPrinting cache stores only the first 1000 values from each QlikView field. 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 from the Qlik NPrinting main menu, 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. For example, select Sales Demo.
  5. Click Create to create the report.

Adding a field

Do the following:

  1. Click Fields in the filters menu.
  2. Click Add field.
  3. Under Connection, select your connection.
  4. Under Name, select a field name.

  5. 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, which is the default setting, 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. Leave Value is in the Values area. This option forces Qlik NPrinting to select the list of values that you specify.
  2. Start to type part of the value you want in the dialog window.
  3. Select your value when it appears.
  4. If you want to add a second value, click Add value.

    A new empty row appears.

  5. Start to type your second value in the new dialog window.
  6. Select your value when it appears.
  7. 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, as above.
  2. Scroll down to the Values area.
  3. Select Evaluate value from the drop-down list.

    This option forces Qlik NPrinting to send the formula that you insert in the dialog box to QlikView or Qlik Sense, which will evaluate the result and return it to be used in the filter.

  4. Enter a formula in the Value box.

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

    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

Note: 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.
  2. Click Filters in the main menu.
  3. Select the filters you want from the Available items.
  4. Click ë 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.

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?