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 expressions and searches. Expressions must use QlikView or Qlik Sense rules and syntax, and return a single value. Expressions are evaluated, and the results are used to filter data. Searches leverage the various kinds of search available in QlikView or Qlik Sense.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. Qlik NPrinting will resolve filters by applying them in a sequence where the initial state has no selections on any field.
If you have a single filter, it is evaluated as follows:
- Clear all selections for all fields, with Override values selected.
- Calculate the expressions for each field with evaluated values.
- Apply selections based on values and searches to all fields.
When you have multiple filters, they are evaluated in the following sequence:
- All task filters are applied one at time, according to their sort order.
- All user filters are applied one at time, according to their sort order.
- All report filters are applied one at time, according to their sort order.
- 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:
- Evaluated values are calculated 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.
- Advanced Search: use this option if you want to select values using a QlikView or Qlik Sense advanced search.
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 a static filter
Do the following:
- Select Apps, and then select Filters.
- Click Create filter.
- Enter a Name for your filter.
- Select an app from the App drop-down list.
- Click Create.
- Click Fields in the filters menu.
- Click Add field.
- Under Connection, select your connection.
-
Under Name, select a field name.
-
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.
Information noteYou 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:
- Choose a value type from the drop-down list:
- Value is
- Numeric value is
- Evaluate value
- Advanced Search
- Depending on the value type, you can choose from a list, start typing a string, or type an expression. See: Selecting values
-
If you want to add a second value, click Add value.
A new empty row appears.
- Add your second value.
- Click Create.
Creating a filter with Select excluded values
When you create a filter, you can exclude specific values, using the Select excluded check box. For example, you may want to exclude data from certain years, or geographic regions. This is similar to the Select excluded operation in Qlik Sense and QlikView.
Do the following:
- Select Apps, and then select Filters.
- Click Create filter.
- Enter a Name for your filter.
- Select an app from the App drop-down list.
- Click Create. Click Fields in the filters menu.
- Click Add field. Under Connection, select your connection.
- Under Name, select a field name.
- Choose a value type.
-
Select the values you want to exclude.
For example, if the field was Country, you could exclude Sweden and Italy.
- Click the Select excluded check box.
- Click Create.
Creating a dynamic filter with evaluated values
You can use QlikView and Qlik Sense expressions to calculate values to be used in filters. Each expression must return a single value, and use QlikView or Qlik Sense syntax. For example, you can use an expression to calculate the value of the previous year and compare it with the Year field in a filter.
Do the following:
- Create a new filter.
-
Click the Values tab, and select Evaluate value from the drop-down.
This option sends your expression to QlikView or Qlik Sense, which will evaluate the result and return it to be used in the filter.
- Enter an expression 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 expression. Adding many values for the same field creates a logical "OR" association. The filter will keep data that matches one or both values.
- Click Create.
Creating a dynamic filter with advanced search
You can use QlikView and Qlik Sense advanced search to select a set of values to use in filters.
Several types of advanced search are supported:
- Text: all values that match the text exactly are selected.
- Wildcard: *, ? and ^ can be used as wildcards in a text search.
- *: placeholder for 0 or more undefined characters.
- ?: placeholder for one undefined single character.
- ^: placeholder that specifies that the next character is the beginning of a word.
- Numeric: if a search starts with < or > it will be evaluated as a numeric search
- Expression: if a search starts with an = it will be evaluated as an expression search. The result of the expression is interpreted as a Boolean:
- 0=false
- Any other value=true
Your advanced search results are intersected with the values selected on the field in previous filters if Override Values is not used. The value set generated from an expression search depends on the current selections, similar to how evaluated values are calculated. If you want to ignore the current selections in an app or document, you should use:
- Qlik Sense: Set analysis and set expressions
- QlikView: Set analysis and set expressions
There are dynamic search types that are not supported. The following may return unexpected results:
- Normal: searches that match the inserted text with the beginning of a word in a field value. You will receive more accurate results with a wildcard search: *^text to search*.
- Fuzzy: searches that begin with ~. In QlikView and Qlik Sense, fuzzy search selects the first value in the list shown on screen. In Qlik NPrinting, it selects every value in the list.
- Compound: searches that enclose search text between ( ) and using operators like |, & and ^ to mix the other search types.
Do the following:
- Create a new filter.
-
Go to the Values area, and select Advanced search from the drop-down.
This option will perform a search on the selected field in QlikView and Qlik Sense and return it to be used in the filter.
-
Enter one of the supported searches in the Value box.
For example, to retrieve data from every year except the current one, enter =Year<Year(now()).
- You can click Add value to add another advanced search. Adding many values for the same field creates a logical "OR" association. The filter will keep data that matches one or both values.
- Click Create.
Creating a variable-based filter
You can use a variable in a filter, and set the value of the variable directly during report generation. This temporarily overwrites the original value that the variable has in QlikView or Qlik Sense.
Variable-based filters can be static or dynamic. They can be added to reports, tasks, users, and objects.
For example: You can create two different reports that have the same chart object, but that show different results depending on the variable value. Or, you could create one report with two publish tasks, with different variable-based filters.
Do the following:
- Create a new filter.
- Click the Values tab, and click Create variable.
- Select a connection from the drop-down menu. Under Name, select a dimension.
-
Under Value, type in an existing dimension.
Click the Evaluate check box if you want the variable to be evaluated before it is applied.
- Click Create.
Adding filters to a 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:
- Create a new report, or open an existing one.
- Click Filters in the main menu.
- Select the filters you want from the Available items.
- Click to move the filters into the Selected Items column.
- 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:
- On the Reports screen, click on your report.
- Click the Edit template button to open the Qlik NPrinting Designer template editor.
- 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.
- A new window will open. Select the object you would like to filter, and click OK.
- Drag your new object from the left pane to your report template.
- On the Properties pane, go to Filters and click the ¥.
- A new window will open. Select the filter you would like to use, and click OK.
Information noteIf you accidentally pick the wrong filter, you can click the eraser icon next to the ¥ to remove all filters from an object.
- 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:
- Open the webengine.config file.
- Uncomment the line <!-<add key="include-user-filters" />->.
- Close and reopen Qlik NPrinting Designer.
-
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:
- Open the scheduler.config configuration file.
- Find the "empty-content-text" tag. Uncomment this line, and edit the value.
- 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.