Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

check if an Nprinting task finished successfully or not in QlikSense

Hello
I have a Qlik Sense file in which I'm triggering an Nprinting task
script runs successfully and the nprinting task is triggered

what I want is to know from Qlik Sense if the task failed or ran successfully
kindly advise on how to achieve this

I can walk on water when it freezes
Labels (2)
1 Solution

Accepted Solutions
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @ali_hijazi 

I have already implemented this in my NPrinting.qvs 

https://nprintingadventures.com/2019/04/08/nprinting-api-qlik-rest-subroutines/

Have a look at the "NP_GetExecutionDetails" sub as it is all there ready to use.

cheers

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.

View solution in original post

8 Replies
Frank_S
Support
Support

You may be able to achieve that requirement by setting up and configuring Qlik Alerting.

https://help.qlik.com/en-US/alerting/Content/QlikAlerting/system-alerts.htm

 

NPrinting, as you may know already, does not have built in alerting capabilities. You need to manually review the executions page for execution activity.

 

 

For question around Qlik Alerting, please visit: https://community.qlik.com/t5/Alerting/bd-p/qlik-alerting-discussions

Kind regards...

 

Please remember hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
ali_hijazi
Partner - Master II
Partner - Master II
Author

but what I want is to be able to listen if there is a failure in Nprinting task in the script

I can walk on water when it freezes
David_Friend
Support
Support

@ali_hijazi NPrinting does not have this capability in the product.

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @ali_hijazi 

I have already implemented this in my NPrinting.qvs 

https://nprintingadventures.com/2019/04/08/nprinting-api-qlik-rest-subroutines/

Have a look at the "NP_GetExecutionDetails" sub as it is all there ready to use.

cheers

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
ali_hijazi
Partner - Master II
Partner - Master II
Author

Hello @Lech_Miszkiewicz 
I used your script in Nprinting.qvs
I'm able to trigger the desired task
but inside the sub which is NP_GetExecutionDetails
the below lines give error (which are inside the loop)
actual when you read data resident RestNPExecutionsTable I get table not found


ali_hijazi_0-1725874943355.png

 

RestNPExecutionsTable:
SQL SELECT
"id",
"result",
"progress",
"status",
"completed"
FROM
JSON (wrap off) "data"
WITH
CONNECTION( URL "$(vExecutionURL)", HTTPHEADER "cookie" "$(vCookie)", QUERY "Limit" "$(vQuery_Limit)")
;

executions:
LOAD
id as execution_id,
result as execution_result,
progress as execution_progress,
status as execution_status,
completed as execution_completed
RESIDENT
RestNPExecutionsTable
WHERE
id='$(zLastExecution)'
;

DROP TABLE RestNPExecutionsTable;

I can walk on water when it freezes
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @ali_hijazi 

This load script screenshot looks strange as it seems to be straight after authentication and obtaining a cookie. Normally you would need to trigger task, get that task ID and pass it to the executions so you can trace its status. 

Have you inspected load script log? I have put many TRACE statements to ensure as much traceablity as possible. In the query there should be zLastExecution variable populated with last execution ID. Is your script resolving this variable?

The other thing is how many executions you are running at once?

 

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
ali_hijazi
Partner - Master II
Partner - Master II
Author

well yes the zLastExecution was giving empty string
but now it works

a question
what would be the value of vExecutionStatus if the task  is aborted or failed
cause I want to check if the task failed I need to throw an exception saying the task failed or was aborted
so that the script doesn't continue to execute

kindly advise

I can walk on water when it freezes
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @ali_hijazi 

I have cut corners here and only set the rules for couple statuses. 

You need to add your own script to handle particular status for wahtever status you wish to capture:

Lech_Miszkiewicz_0-1725929138438.png

 

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.