Skip to main content

The Multi-Report NPrinting template that conditionally renders content

cancel
Showing results for 
Search instead for 
Did you mean: 
JonnyPoole
Employee
Employee

The Multi-Report NPrinting template that conditionally renders content

Last Update:

Oct 9, 2019 3:30:21 PM

Updated By:

JonnyPoole

Created date:

Dec 3, 2018 10:16:24 AM

Attachments

Overview

It is  possible to conditionally include/exclude content in a single NPrinting template based  on data filters. This is applicable to all filter types (Task, Report, User,Object) as well as cycling and on-demand scenarios.  

The technique is 100% dependent on the fact that if content exists inside a level, and the level evaluates to no values, the content is ignored during report generation. 

If we add a data island to the QlikView or Qlik Sense source application that evaluates to a single or no values depending on filter conditions,  then we can control whether a report is generated with or without content inside the level in the report template.

In the first part of this article we setup a report template to conditionally hide and show different content from the same report template depending on an on-demand selection or an NPrinting filter.  The report template will have multiple app objects :  pie chart, table chart etc...  and a field selection will determine where the NPrinting report will include or exclude the chart. 

In the second part  we  extend the technique to leverage the 'pages' feature as well so that we can not only conditionally include/exclude content but essentially design multiple whole reports in a single NPrinting template and generate different reports template. This allows us to condense styling and layouts and centralize code into a single template.  That reduces the number of templates that need to be deployed and reduces change management updates making for a more scalable deployment model. 

PART I:  Using levels to conditionally include content into a report from a single template

 

The following screen print shows a Qlik Sense Dashboard that contains an an NPrinting On-Demand report: 

Qlik Sense Dashboard - OnDemand Button HighlightedQlik Sense Dashboard - OnDemand Button Highlighted

 

In this dashboard there is a data model field "Chart" showing 2 data values (Pie,Table) through a Filter Pane called "Chart Selection". 

Upon selection of "Pie" a Pie is shown in the dashboard  as follows

Qlik Sense Dashboard - Pie Chart SelectedQlik Sense Dashboard - Pie Chart Selected

 

When the user clicks 'Run Report' , the  selections are passed to NPrinting , including the selection Chart='Pie'. Upon completion the on-demand executions pane shows a download icon

 

On-Demand Report Execution-Pie Chart SelectedOn-Demand Report Execution-Pie Chart Selected

..and when opened NPrinting has included the same pie chart filtered correctly.

 

NPrinting Report - Pie Chart includedNPrinting Report - Pie Chart included

 

Likewise, if the user were to change the field selection to Chart='Table' and submit a new on-demand request   (They may also change other selections such as the Names....

 

Qlik Sense Dashboard - Table SelectedQlik Sense Dashboard - Table Selected

..and after downloading the result of the new execution...

 

On-Demand Report Execution - Table SelectedOn-Demand Report Execution - Table Selected

 The Report is generated with the Table

NPrinting Report - Table includedNPrinting Report - Table included

 

In order to create this sample the following are required:

 

1.  November 2018 Qlik Sense.  These techniques use the On-Demand button included in the dashboard bundle with November 2018 Qlik Sense

2.  A new data model field that includes names of the different App Objects to include (or exclude).

3.  Associations to additional data model fields that include just one value (one field with one value per App Object)

4.  NPrinting levels in the Report Template (one per App Object)

5. Report Template Error handling enabled

 

The new data model fields and associations can be seen in the following screen prints:

 

DataModelFields.PNG

Data Model Viewer.PNG

The ShowPie data model field is dedicated to the 'Pie' App Object and the ShowTable data model is dedicated to the 'Table' App object such that, associatively,   ShowPie has NULL values if the user selects 'Table' for 'Chart' and ShowTable has NULL values if the user selects 'Pie' for 'Chart'

 

ShowPieAssociative.PNGShowTableAssociative.PNGWhats 

 

Now, author the NPrinting Report to include levels for each data model field dedicated to the App object (ShowPie,ShowTable).   And place the 'Pie' App Object and the 'Table' App object within the respective level sections of the report. 

NPrinting design.png

 

Finally, enable the following report template property so that NPrinting does not error out when either LEVEL evaluates to NULL

 

errorhandling.png

 

This technique is valid in any Report Template where you use levels.

 

Attached is a sample that for reference.  Note that the sample has other techniques around on-demand including how to conditionally show the On-Demand button only after filtering the data set to a limited number of records.

Since PowerPoint templates do not support levels, the technique is limited but still possible by using the  'pages'  features which does work with the same techniques .

PART II:  Add pages to conditionally render different  reports from a single template

We can build on the technique to do design multiple 'whole' reports in a single template and generate different reports based on the same field selection technique .  To do this, we must utilize the 'pages' feature in conjunction with the 'levels' feature documented above. 

In the updated example below,  the name and fields of the 'ChartControl' Table has been updated to reflect this intended to be a 'ReportControl' . 

 

clipboard_image_0.png

The associative logic eliminates Report1 or Report2 based on the selection in the 'Report' field.

clipboard_image_3.pngclipboard_image_4.png

In the associative model ,  the data island still uses a central control table with a group (two in this case) of single record boolean tables for each possible report 

clipboard_image_2.png

 

In the updated version of the report template below ,  a PAGE has been added based on the 'Report' Field in the 'ReportControl'

Some of the elements (in blue below)  will include styling and content that is common to both reports. They can include dynamic objects, variables, formulas or 3rd party content. 

Other elements ( green, orange) will be specific to each report. 

clipboard_image_1.png

 

When no filters / selections , the reports are paginated.  Depending on the output and template this will result in page breaking , multiple sheets , multiple slide.

clipboard_image_5.pngclipboard_image_6.png

Otherwise , with just one Report selected,  only the content necessary for the chosen report is included

clipboard_image_7.pngclipboard_image_8.png

 

For publish tasks,  NPrinting Filters can be added in the NPrinting Web Console ,  through and Excel Import Task, or via the REST API. 

Here the same two filters added in the NPrinting Console

clipboard_image_10.png

Detailed Filter descriptions below

clipboard_image_9.pngclipboard_image_12.png

 

The filters can be used as a Task Filter, Report Filter, or User Filter to ensure the right users are sent the right reports at the right time using the same template. 

In addition,  you can build ALL the reports at once using the 'Cycle' feature.  

clipboard_image_13.png

 

Labels (1)
Contributors
Version history
Last update:
‎2019-10-09 03:30 PM
Updated by: