How to Make Reports Selectable with NPrinting On-Demand

    We suggest that you do the How to Use NPrinting On-Demand to Set Recipients in Tasks before starting this tutorial.

    This tutorial shows how to create a QlikView document that enables users to select the reports to generate via NPrinting On-Demand.

    The steps will be:

    • Load the list of available reports into the QlikView document and display it
    • Add an NPrinting Report Extension that reads the selected report and and uses it to request the report from the server. To achieve this, we’ll add a QlikView formula to the NPrinting Report Extension that retrieves the name of the selected report.

    This tutorial also explains how to use formulas inside NPrinting Extension objects to make them dynamic and reduce maintenance.

    Attention: remember to save QlikView documents used as NPrinting connections with WebView mode deactivated. NPrinting cannot open QlikView documents with WebView mode activated because it doesn't have full control of QlikView functionalities.

         

    Add Code to Script

                     
                Add-Code-to-Script.png                 
           
    • Open the SalesDemo for Ajax.qvw QlikView document C:\NPrintingTraining\QlikViewDocuments\
    • Open the script editor (CTRL+E)
    • Enter the following code to generate a list of available reports:

    AvailableReports:

    LOAD * INLINE [

    ReportID

    Excel Report Top 25 Products

    PowerPoint Report with Multiple Pages - Current Selections

    Word Report with Table of Contents

    ];

    • This adds three reports. We suggest copying the report names from NPrinting and pasting them into the script because they must be exactly the same.
    • Run a reload (CTRL+R), save the QlikView document and close the script editor
      

    Turn Off WebView

                     
                Turn-Off-WebView.png                 
           

    De-activate WebView (View -> Turn on/off WebView) if active.

    Add List Box to Sheet

                     
                Add-List-Box-to-Sheet.png                 
           

    Add a new sheet object to let users select a report to generate

    • Right click List Box object
    • Select New Sheet Object and click on list box
    • Set  Field to ReportID
    • Put a check mark in the Always One Selected Value box so that only one ReportID can be selected to be sent  to the NPrinting Server
    • Enter Select the report you want to preview in the Caption field
    • Click on the OK button
    • Re-activate WebView (View -> Turn on/off WebView)
      

    Configure On-Demand Service Connection

                     
                Configure-On-Demand-Service-Connection.png                 
           
    • Add an NPrinting Report Extension
    • Right click on the sheet
    • Select New Sheet Object
    • Go to Extension Objects menu
    • Drag and drop a new NPrinting Report object onto the sheet
    • Right click on the object
    • Select Properties
    • Click on Button appearance

    Text: enter the QlikView formula ='Preview '& getfieldselections(ReportID,',',1) & ' report'. The button will display the selected report's name

    Text Color: enter the QlikView formula =White()

    Button Color: enter the QlikView formula =rgb(66,80,80)

     

    Configure On-Demand Service Connection

                     
                Configure-On-Demand-Service-Connection-1.png                 
           

    On-Demand Service Connection

    • Hostname: localhost. Of course you can use a variable here also and use it in all objects so that when the server name changes you need to change only one variable value
    • HTTP Port: 9001
     

    Configure Report Settings

                     
                Configure-Report-Settings.png                 
           

    Report settings

    • Friendly name: enter the QlikView formula =GetFieldSelections(ReportID,',',1). In the NPrinting Queue button you’ll see only the report ID
    • NPrinting Project path: C:\NPrintingTraining\NPrintingFiles\OnDemand.nsq. QlikView formulas are also supported here
    • Report ID: enter the QlikView formula =GetFieldSelections(ReportID,',',1)
    • Connection ID: Sales Demo
    • Output format: PDF
    • Close the Properties window

    Formulas can be used in all NPrinting Extension Object fields having the “fx” on the right side

    Save the QlikView document

       

    Demand Report Generation

                     
                Demand-Report-Generation.png                 
           
    1. Select Word Report with Table of Contents in the list box
    2. Click on the Demand button
       

    Demand Second Report Generation

                     
                Demand-Second-Report-Generation.png                 
           
    1. Without waiting for the first report to finish being generated, select the report Excel Report Top 25 Products
    2. Click on the request button.
        

    Reports Are Ready

                     
                Reports-Are-Ready.png                 
           

    NPrinting Server will create the two reports sequentially and you can open them when they are ready. Click directly on the Reports queue (2) button.

    Inspect First Report

                     
                Inspect-First-Report.png                 
           

    Word Report with Table of Contents

      

    Inspect Second Report

                     
                Inspect-Second-Report.png                 
           

    Excel Report Top 25 Products

    We suggest that you do the How to Use NPrinting On-Demand with Section Access tutorial now that you have completed this tutorial.