How to Use NPrinting On-Demand to Set Recipients in Tasks

    We suggest that you review How to Use Specific Filters with NPrinting On-Demand Reporting before doing this tutorial.

    Forms inside NPrinting Extension Objects accept QlikView formulas as an argument. You’ll learn in this tutorial how to use them to select recipients and send reports. We’ll display a list box containing recipients in a QlikView document to let users select one or more recipients. Users select recipients the same way they select QlikView filters. Click on an NPrinting Task Extension that retrieves the names of the selected recipients and sends them filtered reports.

    The steps are:

    • Create recipients in NPrinting with filters
    • Create an NPrinting task that sends a report via email
    • Load a list of recipients into the QlikView document and display their names
    • Create an NPrinting Task Extension that runs the task

    The NPrinting 16 Training & Installation/Upgrade Information contains a working example for this tutorial. Please download NPrinting Training Material if you haven't recently done so, and extract it into C:\NPrintingTraining\ so that the relative path structure continues to be valid.

    Create New Recipient

    Create-New-Recipient.png

    Open the NPrinting document, OnDemand.nsq, in C:\NPrintingTraining\NPrintingFiles\

    1. Add a recipient named Elvis Presley
    2. Add a filter for Salesman=Elvis Presley
    3. Set an email address that you can read
    4. Save and New

    Create a Second Recipient

    Create-a-Second-Recipient.png

    Add recipient Rob Carsson without filters

    • Set an email address that you have access to
    • Save and Close

    Create an NPrinting Task

    Create-an-NPrinting-Task.png

    Create an NPrinting task named Task Send Top 25 Products with Current Selections.

    See: How to Create Tasks

    1. Add the "Excel Report Top 25 Products" report
    2. Set Output Format to PDF

    Activate Send Email and Create a Message

    Activate-Send-Email-and-Create-a-Message.png

    1. Activate the Send Email feature by putting a check mark in the box
    2. Create a message. See: What elements can I add to NPrinting e-mail?

    Save and close the task. Click on YES on the warning message that asks you to insert at least one recipient: you can leave the Recipients List empty. Save the NPrinting project.

    Load Recipients into the QlikView Document

    Now, we can load our new recipients into the QlikView document using the load script. If you use NPrinting's features for importing recipients, you can develop a QlikView load script that loads recipients from a source file. See: How to Import Recipients from QlikView Documents - Features Track. You cannot import recipients directly from NPrinting to QlikView or vice versa at the present time.

     

    Add Additional Recipients to Script

    Add-Additional-Recipients-to-Script.png
    Open the SalesDemo for Ajax.qvw document in C:\NPrintingTraining\QlikViewDocuments\
    • Add this code at the beginning:
    AdditionalRecipients:LOAD * INLINE [FullName, E-mail, Folder, Sub FolderElvis Presley, , C:\NPrintingTraining\Output\Elvis, ElvisRob Carsson, , C:\NPrintingTraining\Output\Rob, Rob];
    • Reload the document
    Be sure to insert the same recipients' names in the NPrinting project and in the QlikView document.

    Add a List Box

    Add-a-List-Box.png
    • Add a List box to the Simple On-Demand sheet  to display the field Fullname
    • Save the QlikView Document

    Embed NPrinting Task Extension and Configure Button Appearance

    Embed-NPrinting-Task-Extension-and-Configure-Butto.png
    • Create an NPrinting Task Extension that runs the Task Send Top 25 Products with Current Selections task
    • Right click on the sheet
    • Select New Sheet Object
    • Click on Extension Objects
    • Drag and drop the NPrinting Task object onto the sheet
    • Right click on the object
    • Select Properties
    • Click on the "Button appearance" bar and edit
    Insert the Text: "Task Send Top 25 Products with Current Selections"Set the Button color: =rgb(66,80,80)

    Configure On-Demand Service Connection

    Configure-On-Demand-Service-Connection.png
    Click on the On-Demand service connection bar
    1. Hostname: localhost
    2. HTTP Port: 9001

    Configure Task Settings

    Configure-Task-Settings.png
    • Click on the Task settings bar
    • Friendly name: Task Send Top 25 Products with Current Selections
    • NPrinting Project path: C:\NPrintingTraining\NPrintingFiles\OnDemand.nsq
    • Report ID: Task Send Top 25 Products with Current Selections
    • Connection ID: Sales Demo
    • Additional recipients: insert the QlikView formula =GetFieldSelections(FullName). This formula returns the selected active recipients and sends them to NPrinting Service, so it will send them the reports. Dynamic selection is obtained using this QlikView formula.

    Configure Filter Settings

    Configure-Filter-Settings.png
    • Click on the Filter settings bar
    • Use current selections: check marked
    • Close the Properties editor
    • Save the QlikView document

    Send Report to a Recipient

    Send-Report-to-a-Recipient-.png

    1. Select an additional recipient, Elvis Presley for instance
    2. Click "Task Send Top 25 Products with Current Selections"

     

     

    Check E-mail

    Check-E-mail.png

     

    When the NPrinting Queue button shows that the task has completed, check the e-mail account that you've associated with the Elvis recipient and you’ll find the report.

     

    Inspect Report

    Inspect-Report.png