Qlik Community

Qlik NPrinting Documents

Documents related to Qlik NPrinting.

How to Execute NPrinting Reports by External XML Request

Not applicable

How to Execute NPrinting Reports by External XML Request

You can set up the NPrinting service to accept requests to execute Tasks and Jobs that are submitted by XML files saved in a specific folder.

There are two steps to this process:

  1. Configure NPrinting Service to accept XML requests (see How to Configure NPrinting Service)
  2. Generate XML files with a specific syntax and save them in the folder you specify in the previous step.

NPrinting Service regularly checks for new XML files with the .request extension in the defined source folder, parses any new ones it finds, executes the contained instructions, and renames the file by changing the .request extension to .processed. It then writes information into a new file about what Task(s) or Job(s) were run and their outcome. Finally it names the file with the .result extension. Execution will be queued with any other schedule jobs to be executed.

The Task or Job can be reactivated just by changing the extension on the XML file back to .request. Paths to files on remote servers must be absolute paths.

When you install NPrinting Server, NPrinting Management Console is also installed as a component and is the GUI for configuring automated report generation and distribution. Launch NPrinting Management Console by clicking on its desktop or taskbar icon or searching for NPrintingSvcConfig.exe and double clicking on it.

Permit NPrinting Service Config to Make Changes

Permit-NPrinting-Service-Config-to-Make-Changes.png

The first thing that happens when you start NPrinting Management Console up is the User Account Control window pops up. Click on the Yes button to proceed.

Add NPrinting Project File(s)

Add-NPrinting-Project-File-s-.png
  1. The Service page is pre-selected
  2. Click on the Add button

All paths to NPrinting files saved on computers different from the one running NPrinting Service must be absolute paths (e.g. \\Server\NPrinting\Templates - NOT Z:\NPrinting\Templates).

Select NPrinting Project File(s)

Select-NPrinting-Project-File-s-.png
  1. Browse to C:\NPrintingTraining\NPrintingFiles\ and select NPrintingTraining.nsq
  2. Click on the Open button

Enable External Requests

Enable-External-Requests.png
  1. Put a check mark in the Enable external requests box
  2. Click the browse button to configure the directory where XML files to be executed by NPrinting Service are to be saved. See: How to Configure NPrinting Service

Select Source Folder

Select-Source-Folder.png
  1. Browse to C:\NPrintingTraining\ and select the ExternalRequestsXML folder. Use Make New Folder if necessary
  2. Click on the OK button

Request files

Request files are XML files with .request extension. Once they get processed the extension is changed to .processed without changing the content. A .processed extension file can be renamed to a .request extension file by a batch file or other process, reactivating the Task or Job.

The following is given In the file (feel free to copy, paste, and put in the necessary parameters):

  • .nsq file to use
  • type of entity: Job or Task
  • name of the entity

File structure:


<?xml version="1.0"?>

<schedules>

     <schedule file="" type="" entityName="" />

</schedules>

Example1:


<?xml version="1.0"?>

<schedules>

     <schedule file="C:\NPrintingTraining\NPrintingFiles\NPrintingTraining.nsq" type="job" entityName="AccessPoint Report" />

</schedules>


Note: remember that an absolute path must be used for files residing on a remote server.

This will execute:

  • NPrinting Job called "AccessPoint Report"

Example2:


<?xml version="1.0"?>

<schedules>

     <schedule file="C:\NPrintingTraining\NPrintingFiles\NPrintingTraining.nsq" type="task" entityName="Send an HTML embedded Report" />

     <schedule file="C:\NPrintingTraining\NPrintingFiles\NPrintingTraining.nsq" type="job" entityName="Sales Report" />

</schedules>

This will execute:

  • NPrinting Task called "Send an HTML embedded Report"
  • NPrinting Job called "Sales Report"

Result files

Results files are XML files with the .result extension. They contain information regarding execution of the XML .request files

The information they contain is:

  • .nsq file which was used
  • type of entity: Job or Task
  • name of the entity
  • Date-Time of the start of the processing in ISO format
  • Number of errors/warnings (if any)
  • List of errors/warnings (if any)

File structure:


<?xml version="1.0"?>

<scheduleResults>

     <scheduleResult file="" type="" entityName="" startTime="" result=""/>

     <scheduleResult file="" type="" entityName="" startTime="" result="" warningCount="" warningMessage=""/>

     <scheduleResult file="" type="" entityName="" startTime="" result="" errorCount="" errorMessage=""/>

</scheduleResults>

Example1:


<?xml version="1.0"?>

<scheduleResults>

     <scheduleResult file="C:\NPrintingTraining\NPrintingFiles\NPrintingTraining.nsq" type="job" entityName="AccessPoint Report" startTime="2013-12-27T16:55:27.421+01:00" result="success"/>

</scheduleResults>

Comments
sohailansari201
Not applicable

Does this apply to NPrinting 17 and higher as well?

Thank you,

nicolett_yuri
Not applicable

Thanks for sharing

kevinpintokpa
Not applicable

Is this still valid in NPrinting 17?  I cannot find any place to enable external requests in NPrinting 17 Admin console.

lech_miszkiewicz

Lech_Miszkiewicz
Not applicable

Hi Kevin,

for NPrinting 17 starting from version June 2017 API was developped. http://help.qlik.com/en-US/nprinting/June2017/APIs/NP%20API/

you will have to write piece of software to levarage this as currently there is no embeded option

cheers

Lech

kevinpintokpa
Not applicable

Thanks!

It looks like POST /tasks/{taskId}/executions is the API function to call:

http://help.qlik.com/en-US/nprinting/June2017/APIs/NP%20API/#tasksTaskIdExecutionsPost

santoshknc
Not applicable

Hi lech_miszkiewicz / kevinpintokpa,

Could you please confirm if the Tasks Methods can be used for v17.3 too ?

In theh help.qlik.com i cannot see the methods for the Tasks for NPrinting v17.3, Could you please provide inputs on this like how can we trigger the Tasks in v17.3 from Outside ?

Thanks & Regards,

Santosh Kumar.

djbloiss
Not applicable

Is there a way I can speed up the calls?  It sometimes takes a few minutes, sometimes it takes 20 minutes or more. It seems that the NPrinting server seems to look in that folder in intervals.  so it depends when this is run as close to when the server looks in the folder.  Can I make that interval more often?

Ruggero_Piccoli
Not applicable

Hi,

Qlik NPrinting 16.* Server looks at the folder once every minute and you cannot change this value. If it takes more maybe it is because it is doing something else. Note that Qlik NPrinting 16.* is mono-thread and mono-task so if it is doing something else it will first finish the task it is doing and only after it starts to execute new tasks.

You should be able to see this by checking the logs.

Qlik NPrinting 17+ is multi-task, multi-thread and multi Engines so it will scale better. With the 16.* you could install a second server dedicated only on .xml tasks.

Best Regards.

vincent_ardiet
Not applicable

Hi,

Sometimes our nPrinting is a bit busy (or it hangs on a qv.exe run) and .request files are accumulating.

When nPrinting is able to treat them, it doesn't process them from the older to the newest but in a kind of random order (or maybe alphabetically but I haven't checked).

Is it a way to ask it to follow the queue by time order?

Regards

Ruggero_Piccoli
Not applicable

Hi,

No with different files but you could to merge them in a single file with you desired order.

Another idea could be to install two Qlik NPrinting servers one focused only on xml requests.

Another upgrade to 17+ version that scales better.

Best Regards,

Ruggero

Version history
Revision #:
1 of 1
Last update:
‎04-24-2015 04:23 AM
Updated by: