Qlik Community

Qlik NPrinting Discussions

Discussion Board for collaboration on Qlik NPrinting.

yduval75
Contributor III

To know when NPrinting job is finished with external XML request

We launch NPrinting job with external XML request.

Our scheduler use the following command : move "E:\Data-01\NPrintingData\OnDemandXML\Application.processed" "E:\Data-01\NPrintingData\OnDemandXML\Application.request"
The scheduler needs to know when the job is finished and if the job result with sucess or not but no error code is generated at the end of the job.
Do you know if it's possible to know when NPrinting job is finished and then execute the 2nd command with the scheduler ?

Thanks a lot

Yoann DUVAL

1 Solution

Accepted Solutions
djk
Valued Contributor III

Re: To know when NPrinting job is finished with external XML request

Hi Yoann,

Here are a couple of things to consider:

* Since QlikView NPrinting version 15, you have the option to send an e-mail on completion of an external XML request. NPrinting 15 Release Notes

* On completion of an external XML request QlikView NPrinting creates a file with the same name as the request file but with extension .result. Take a look at the Result files section of this document How to Execute NPrinting Reports by External XML Request. This file contains result information which can be checked. For example you could schedule a batch file something like the one below to run every 5 minutes in Task Scheduler. It checks for the existence of the .result file and then calls a different batch file depending on the results found within. It then renames the result file by changing the extension to .renamed. You could also un-comment lines 4 & 5 to continually check for the existence of the file every ~30 seconds.

@echo off

:CheckForFile

if exist "E:\Data-01\NPrintingData\OnDemandXML\Application.result" goto FileExists

rem ping -n 30 localhost >NUL

rem goto :CheckForFile

ECHO File does not exist

EXIT /B 1

:FileExists

ECHO File Exists

@ECHO off

echo.

findstr /M "result=\"error\"" "E:\Data-01\NPrintingData\OnDemandXML\Application.result"

if %errorlevel%==0 (

echo Error Found!

START ErrorFound.bat

)

findstr /M "result=\"warning\"" "E:\Data-01\NPrintingData\OnDemandXML\Application.result"

if %errorlevel%==0 (

echo Warning Found!

START WarningFound.bat

)

findstr /M "result=\"success\"" "E:\Data-01\NPrintingData\OnDemandXML\Application.result"

if %errorlevel%==0 (

echo Success Found!

START SuccessFound.bat

)

REN "E:\Data-01\NPrintingData\OnDemandXML\Application.result" Application.renamed

EXIT /B 2

HTH,

Daniel.

1 Reply
djk
Valued Contributor III

Re: To know when NPrinting job is finished with external XML request

Hi Yoann,

Here are a couple of things to consider:

* Since QlikView NPrinting version 15, you have the option to send an e-mail on completion of an external XML request. NPrinting 15 Release Notes

* On completion of an external XML request QlikView NPrinting creates a file with the same name as the request file but with extension .result. Take a look at the Result files section of this document How to Execute NPrinting Reports by External XML Request. This file contains result information which can be checked. For example you could schedule a batch file something like the one below to run every 5 minutes in Task Scheduler. It checks for the existence of the .result file and then calls a different batch file depending on the results found within. It then renames the result file by changing the extension to .renamed. You could also un-comment lines 4 & 5 to continually check for the existence of the file every ~30 seconds.

@echo off

:CheckForFile

if exist "E:\Data-01\NPrintingData\OnDemandXML\Application.result" goto FileExists

rem ping -n 30 localhost >NUL

rem goto :CheckForFile

ECHO File does not exist

EXIT /B 1

:FileExists

ECHO File Exists

@ECHO off

echo.

findstr /M "result=\"error\"" "E:\Data-01\NPrintingData\OnDemandXML\Application.result"

if %errorlevel%==0 (

echo Error Found!

START ErrorFound.bat

)

findstr /M "result=\"warning\"" "E:\Data-01\NPrintingData\OnDemandXML\Application.result"

if %errorlevel%==0 (

echo Warning Found!

START WarningFound.bat

)

findstr /M "result=\"success\"" "E:\Data-01\NPrintingData\OnDemandXML\Application.result"

if %errorlevel%==0 (

echo Success Found!

START SuccessFound.bat

)

REN "E:\Data-01\NPrintingData\OnDemandXML\Application.result" Application.renamed

EXIT /B 2

HTH,

Daniel.

Community Browser