NPrinting Filters – Part 4 (Variables)

This is second last filters feature gap which just got patched in NPrinting November 2019. This version introduces variable filters which in short allows you to set variable value when executing task or whenever filter is used.

Now how and when you may want to use it?

Variable as chart dimensions: It is very common in QlikView and Qlik Sense application to use variable as dimension. This allows for dimension toggle depending on user choice. If the same Qlik object needs to be used in NPrinting, with variable filter we can now choose which dimension will be used when report gets produced.

Let’s have a look at the sample below. First obvioulsy we need a source of data for NPrinting report. In this sample I am using Qlik Sense. I create 2 variables, first holding a dimension name (field in data model) and second to hold dimension name label.

Creating variables in Qlik Sense

I built sample Qlik Sense table with one dimension and one measure. As a dimension I use variable vDimension_1 and as its label I use vDimension_1_Label variable. Below is a result where you can see that by default label is “First Dimension” and values are coming from “Dim1” field (A,B,C)

Qlik Sense object and variable as dimension

With my source object ready I now move to NPrinting and create report template. I use previously built Qlik Sense table and drag and drop it on the template. Additionally I bring Qlik Sense variable as a NPrinting template variable (variable entity) and use it as a column header to allow for dynamic header label.

NPrinting template with Qlik Sense object (note additional variable used as table column header label)

With the template ready I now move back to NPrinitng console where I create a variable filter. For variable vDimension_1 I assign value Dim2. This will result in using Dim2 column as field/dimension in Qlik Sense table. I also set vDimension_1_Label variable value to “Second Dimension”. I then use this filter as a report filter in NPrinitng.

NPrinting filter replacing default Qlik Sense variable values

When I run NPrinting report variable filter is used and it adjusts dimension in chart. See results below.

Process overview

The above sample shows how you assign static value to variable. Regardless of where this variable is used its value can be changed using NPrinting variable filter.

You can change variable value used in set analysis, variable used to calculate time frames (YTD, MTD, WTD etc…), change variable to show different container object, change variable controlling colors or simply use it as a label/text.

What other use cases are feasible? You can comment below and I will be more than happy to take an example and write about it.

cheers

Lech

5 Comments

  1. Hi Lech

    Great article!
    I was also excited about this feature. However I am missing something very important and maybe you have noticed it as well. When importing variable filters with Excel they are imported wrongly as fields.
    Actually there is a syntax when we imported them in NP 16 like in this thread in the Qlik community: https://community.qlik.com/t5/Qlik-NPrinting-Discussions/Nprinting-Filters-vs-Current-Selections/td-p/967686

    However I’m wondering if you are facing the same issue.

    Kind regards
    Hatus

    Like

    1. Hi Hatus,
      I think there is a bug in current sample files for recipient import. I did test it and I bluntly assumed there should be additional column (judging by how Advanced search was added in previous versions…) so I added it manually..
      In Filters sheet you need to have additional column called “Variables” where you would put your variable name and value/expression
      hope this helps!

      Like

  2. Hi Lech, thanks too much for awesome example showing this new feature. I have the previous version which have limitations to use the ad-hoc filters from a qlik sense app and generating the report with “On demand” extension.

    With this new feature, is possible to define variables and once the task to generate the report take values from variables and filter the data?

    I appreciate your help!

    Thanks

    Gelder

    Like

    1. Hi Gelder,
      This features only applies to built in filter in NPrinting. So for task or report or object or user filter NPrinting will set variable value to whatever you define it in it.

      If you are wanting to set variables directly in Qlik Sense and use them with OnDemand button I do not think it is a good idea. In general variables set by users in QlikView or Qlik Sense applications would not work when used with OnDemand button. The exception from this is when you make your variable value dependant from your field selections.

      However if you are wanting to set in NPrinting (just like i did in the example above) variable filters and then use them together with On Demand report I assume it could work. Those filters would have to be applied on report level.

      Like

      1. Hi Lech

        Thanks for your comments and clarifications. I will prepare the upgrade of the NPrinting and test if can set variable filters and come back with results.

        Thanks and have good day!

        Gelder

        Like

Leave a comment