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: 
wlau
Contributor III
Contributor III

Incomplete List of Connections Returned

I have a Qlik load script where I am trying to execute a task in NPrinting.  This script originated from Qlik and was working for awhile and then it stopped working.  I went through the script in debug mode and narrowed it down to the step where a list of NPrinting connections was requested.  I added an exit script right after the "RestConnectionMasterTable" was created to see what was in that table.  As expected, I see the names of the NPrinting connections but its not a complete list.  I did not find the connection that I was looking for.  I went on the NPrinting server and checked that the connection existed.  As a result, if I remove the exit script and let the reload continue, the connection id would be queried and used to build additional URLs.  Since my connection did not exist in the table,  any further REST calls will fail. 

 

//GET the list of the connections contained in the NP App selected before
RestConnectionMasterTable:
SQL SELECT
"__KEY_data",
(SELECT
"id",
"name",
"appId",
"__FK_items"
FROM "items" FK "__FK_items")
FROM JSON (wrap off) "data" PK "__KEY_data"
WITH CONNECTION( URL "$(v_NPRINTING_URL)/api/v1/connections", HTTPHEADER "cookie" "$(vCookie)" );

[connection_items]:
LOAD [id] AS [connection_id],
[name] AS [connection_name],
[appId] AS [connection_appId]
RESIDENT RestConnectionMasterTable
WHERE NOT IsNull([__FK_items]) AND [appId] = '$(vAppId)' and upper([name]) = upper('$(v_CONN_NAME)');

//Extracts the desired Connection ID
let vConnectionId = Peek('connection_id',0,'connection_items');

IF NoOfRows('connection_items') = 0 then

TRACE ERROR >>>>> Connection ID Not Found;
//CALL ThrowError('Error: Connection ID Not Found')
Set TriggerError;
exit script;
end if


//Compose the URL for the POST call that triggers a reload metadata
let vReloadMetadataURL = '$(v_NPRINTING_URL)/api/v1/connections/'&'$(vConnectionId)'&'/reload';

//Compose the URL for the GET call that checks the connection status
let vConnectionStatusURL = '$(v_NPRINTING_URL)/api/v1/connections/'&'$(vConnectionId)';

DROP TABLE RestConnectionMasterTable;

Labels (2)
2 Solutions

Accepted Solutions
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi, 

You are not using QueryLimit parameters in your REST queries which is likely the reason why you are not getting all connections.

Have a look at my NPrinting.qvs library : https://nprintingadventures.com/2019/04/08/nprinting-api-qlik-rest-subroutines/ where you will find examples of how it needs to be used to get full result set

1.jpg

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

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

by the way - query limit is the number of records you want to return from query. If you dont have this parameter only limited (I think 50) records are returned

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

3 Replies
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi, 

You are not using QueryLimit parameters in your REST queries which is likely the reason why you are not getting all connections.

Have a look at my NPrinting.qvs library : https://nprintingadventures.com/2019/04/08/nprinting-api-qlik-rest-subroutines/ where you will find examples of how it needs to be used to get full result set

1.jpg

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.
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

by the way - query limit is the number of records you want to return from query. If you dont have this parameter only limited (I think 50) records are returned

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.
wlau
Contributor III
Contributor III
Author

Thank you.  That did the trick.  We also added that parameter to other parts of the script such as the request to get lists for applications and tasks from NPrinting.