Qlik Community

Qlik NPrinting Discussions

Discussion Board for collaboration on Qlik NPrinting.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner
Partner

Triggering Multiple Connection Metadata Reloads using Qlik Sense API Script

Hi All,

I have been using the Qlik Sense API Script that was so helpfully been put together in this thread:

https://community.qlik.com/t5/Qlik-NPrinting-Discussions/How-to-use-Qlik-NPrinting-APIs-inside-a-Qli...

Have had no problems in most of my usages, but for my current project I have two connections that sit inside my NPrinting app and both are needed in the report output.

 

When i run the script, only one of the connections refreshes before publish job gets triggered. I do not have much knowledge on API's within Qlik, is it possible to refresh ALL connections associated with an app before running publish task?

 

Kind Regards,

Stephen

Labels (2)
3 Replies
Highlighted
Partner
Partner

Yes its possible, just a GET to /connections with a filter on appId and then a loop for all fetched connectionIds towards POST /connection/{id}/reload.

I havn't read the post you refering to, but why do you need to update NP metadata everytime you run the NP task?

Highlighted

sure it is possible.. Just change your script to loop through connection id's and launch all of them..

I wrote subroutines to do that:

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

 

all what you will need to do is to configure variables and call it like:

//  Authenticate
Call NP_Authenticate;
    Drop Table cookie_items;
//  Get App
Call NP_GetAppID('$(vNPrintingAppName)')
    Drop Table apps_items;
//  Get and Reload All Connections
Call NP_ConnectionReload
//  Get Task 
Call NP_GetTasks('here put task name')
//  Trigger Tasks
Call NP_TriggerTasks
                
Drop tables 
    task_items,
    connection_items,
    _post_items
;  

 

once configured it is super easy to maintain various scenarios with reloads and you have a lot more parameters you can control

 

On the other hand - why do you need to reload connection metadata when you using Qlik Sense? With Qlik Sense it is not required at all unless you are doing development changes in your model.

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.
Highlighted

@blaise just noticed your post - and exactly the same train of thoughts! 🙂 haha

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.