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: 
bluecarbon
Partner - Creator
Partner - Creator

nprinting 17 task reload after QMC task

Hi,

Is there a way to trigger a Nprinting 17.3 task after completion of a QVW task in QMC like it was done in Nprinting 16.

Thanks,

Rakul

1 Solution

Accepted Solutions
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

sure thing.. in short here is a cascade of tasks:

  • Reload your app in QMC
    • Create a simple small qvw file which will run right after your app is reloaded.
      • (Execute  Batch)This small app will have an Execute statement in it which will trigger a batch file which will open a html file.
        • Open HTML and USE API

2 first steps can be triggered from QMC in QLikView and rest is done via APIs

Attached is HTML File which you just need to change to point to your task Id and server name.

More details here:

https://branch-blog.qlik.com/nprinting-api-for-noobs-7c1343a99ad8

cheers

Lech

---------------------------------------------

When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.

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

22 Replies
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

sure thing.. in short here is a cascade of tasks:

  • Reload your app in QMC
    • Create a simple small qvw file which will run right after your app is reloaded.
      • (Execute  Batch)This small app will have an Execute statement in it which will trigger a batch file which will open a html file.
        • Open HTML and USE API

2 first steps can be triggered from QMC in QLikView and rest is done via APIs

Attached is HTML File which you just need to change to point to your task Id and server name.

More details here:

https://branch-blog.qlik.com/nprinting-api-for-noobs-7c1343a99ad8

cheers

Lech

---------------------------------------------

When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.

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.
grs_venki
Contributor II
Contributor II

Hi, Thank you for your code, However I have tested in my environment with same code and changed Task ID and Servername. But It didnt triggered the job. Could you please help me understand, Is there any other setting needs to be done prior to execute HTML code in IE 11.

-------Code I used -------

<html>
  <head>
  </head>
  <body>
  <h1>NPrinting API task starter</h1>
  <script src="jquery-1.10.1.min.js"></script>
  <script type="text/javascript">
  (function(){
   console.log("started")
   var taskIDs=[
   "232ae927-b691-412a-b0c8-68146e8ce09b"
  
  ]
   $.ajax({
  url: 'httpS://*****:4993/api/v1/login/ntlm',
  xhrFields: {
  withCredentials: true
  }
  }).done(function(data) {
   console.log(data);
  
   for(var i=0;i<taskIDs.length;i++){
   $.ajax({
  type: "POST",
  url: 'httpS://*****:4993/api/v1/tasks/'+taskIDs+'/executions',
  xhrFields: {
  withCredentials: true
  }
  }).done(function(data) {
   console.log("task "+i);
   console.log(data);
if(i==taskIDs.length)
open(location, '_self').close();
  });
  }
  });
  })();
<!-- open(location, '_self').close(); -->
   </script>
  </body>
  </html>
 

I have my credential details after the Page got opened.

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi, It is slightly different code than mine, and you have removed some things from it (like server variable) so it is difficult to troubleshoot.

Also right now you can actualy chain/trigger tasks using REST API if you have the latest version of QlikView / Sense installed with latest REST connector:

How To Use NPrinting APIs In A Qlik Load Script

cheers

Lech

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.
grs_venki
Contributor II
Contributor II

Hi,

I have been using the same code as attached in the previous discussion. But it didnt worked out for me. So I had to change a little bit as same from https://branch-blog.qlik.com/nprinting-api-for-noobs-7c1343a99ad8?_ga=2.263725263.238280957.15209162... screenshot had shared in the discussion. So I was referring the same and followed. By the way I am using the same code as you.

Nprinting 16.6 - I was using External event trigger to run the task from Qlikview QMC to Nprinting server (request file).

Please note - I am using Qlik Nprinting 17.6 (November 2017), IE 11.

Kindly please help me understand the problem to run the task and what steps need to be done prior to run the html batch script.

Steps I followed --> Copied your code and changed Task ID and ServerName and RUN the file. After open the file it had asked me to enter credentials details and I have entered. Then nothing is happening.

Error I found - Protocol - HTTPS, Method - POST, Result - 403, Type - text/html

---- Code Used as you and changed Server name and Task ID -------

<html>

<head>

</head>

<body>

<h1>NPrinting API task starter</h1>

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>

<script type="text/javascript">

(function()

{

console.log("started")

var taskIDs=

[

"2ba0201a-e3e9-4c80-9ac0-99ccaf56c8d1"

]

var serverName=

[

"frafassu883"

]

$.ajax({

url: 'httpS://'+serverName+':4993/api/v1/login/ntlm',

xhrFields: {

withCredentials: true

}

}).done(function(data) {

console.log(data);

for(var i=0;i<taskIDs.length;i++)

{

$.ajax

({

type: "POST",

url: 'httpS://'+serverName+':4993/api/v1/tasks/'+taskIDs+'/executions',

xhrFields:

{

withCredentials: true

}

}).done

(function(data)

{

console.log("task "+i);

console.log(data);

if(i==taskIDs.length)

open(location, '_self').close();

}

);

}

});

})();

<!-- open(location, '_self').close(); -->

</script>

</body>

</html>

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Do you use HTTPS for admin console and news stand? Do you have certificates installed? Do you have permissions/access to admin console?

try login to admin console first, and then try to open this html file in another window. Just in case there is SSL error which needs to be overriden

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.
Venkatchoudary
Contributor III
Contributor III

I have faced same Issue; the code does not work in ‘IE’ Browser.
You should have Chrome to run that batch file.

Venkatchoudary
Contributor III
Contributor III

Will you please share a test QVW that has triggered batch file?

grs_venki
Contributor II
Contributor II

Its working now. There is a problem with Java Add on. I had installed in RDP machine and its working as expected. You should install Java add on in IE browser and check it.

grs_venki
Contributor II
Contributor II

Yes, I do have HTTPS in both Console and Newsstand. I do have full sysadmin access to RDP environment. There was a problem with Java add on in IE Browser. Hence it was not working in RDP machine. Now I have installed java add on and its working fine. Thanks Lech