Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: The support homepage carousel is not displaying. We are working toward a resolution.

REST API task is failing Intermittently with General Script Error in statement handling

0% helpful (0/1)
cancel
Showing results for 
Search instead for 
Did you mean: 
Alan_Slaughter
Support
Support

REST API task is failing Intermittently with General Script Error in statement handling

Last Update:

Sep 23, 2024 9:40:22 AM

Updated By:

Sonja_Bauernfeind

Created date:

Aug 30, 2021 7:23:01 AM

"RestConnectorMasterTable" General Script Error in statement handling

RestConnectorMasterTable:
20200826T102106.344+0000 0088 SQL SELECT
20200826T102106.344+0000 0089 "name",
20200826T102106.344+0000 0090 "value"
20200826T102106.344+0000 0091 FROM JSON (wrap off) "contactCustomData"
20200826T102106.344+0000 0092 WITH CONNECTION (
20200826T102106.344+0000 0093 URL "      ",
20200826T102106.344+0000 0094 HTTPHEADER "Authorization" "**Token removed for security purpose**"
20200826T102106.344+0000 0095 )
20200826T102106.967+0000 General Script Error in statement handling
20200826T102106.982+0000 Execution Failed
20200826T102106.986+0000 Execution finished.

 

Environment

Qlik Sense Enterprise on Windows 

 

Resolution

To be able to catch the exact error and mitigate the issue they need to apply our recommended best practices for error handling in Qlik scripting using the Error variables
Error variables 
Script control statements 

Set to ErrorMode=0 it will ignore any errors and continue with the script. You can use the IF statement to retry the connection or move to another connection for a few attempts and then it will change it to ErrorMode=1 and fail or just disconnect on its own.

A sample script is located here, but further options can be added from the Help links already provided.
Qlik-Sense-fail-and-retry-connection-sample-script 

Note: QlikView scripting is the same in these functions for Qlik Sense unless otherwise stated, but there are some very helpful items in the links.
Best-Practice-Error-Handling-in-Script 

 

Cause 

Error with the fetch of the token with the rest call. If the number of rows in a table doesn't match or is less than expected, trigger the script to throw an error and have it try to load the table again for more records, or if the count is off, do a Loop until returns the correct number.

 

Internal Investigation ID(s) 

QB-3164

Labels (1)
Comments
pablolabbe
Partner Ambassador
Partner Ambassador

Do the internal investigation of this issue finished ? QB-3164

Sonja_Bauernfeind
Digital Support
Digital Support

Hello @pablolabbe 

The Internal Investigation in this case has led to the resolution mentioned in this article.  If you need additional investigation being done or are experiencing a server issue that you identified as a defect, I recommend to log a ticket with Support.

All the best,
Sonja 

Huberto_Computop
Partner - Contributor II
Partner - Contributor II

Hi @Alan_Slaughter,

I am still facing the same problem even after implementing the loop and controlling the script behavior using the ErrorMode variable. From time to time, I get the "General Script Error in statement handling" message from the Qlik Sense app that triggers the QNP REST API methods and the script does not stop as expected.

So far, I haven't figured out a robust and resilient solution via Qlik script. Even though it works for other use cases when I force an error.

Could please shed some light on this topic and provide me and the Qlik Community with the potential causes of this issue and what to solve it via Qlik script?

Thank you for your attention.

Regards,

Huberto

Visual_Intelligence_Support
Partner - Contributor
Partner - Contributor

Same issue, never resolved. Happened at random places when loading data from API in QlikView.

Huberto_Computop
Partner - Contributor II
Partner - Contributor II

Thanks, @Visual_Intelligence_Support.

What do you do when such an error happens? Do trigger the reports manually or did you find an alternative automatic solution?

Regards,

Huberto

francesco_menin
Partner - Creator III
Partner - Creator III

@Huberto_Computop did you manage to find a solution to this issue?

Huberto_Computop
Partner - Contributor II
Partner - Contributor II

Hi @francesco_menin,

Yes, I did it. Simply said, you need to have one Qlik Sense task that triggers one specific Qlik NPrinting task. This QS task has to be set to Max Retries 5 or 10, as you like to retry the QNP task execution.

You need to have this 1:1 (QS task - QNP task) to make sure that when your QS task fails, retrying it won't send out reports that were already dispatched.

The trick here is my QS app name, which looks like this:

  1. QNP_Smart_Report_Daily -> Main app where the visualizations are developed and will be used by QNP to create the reports.
  2. QNP_Smart_Report_Daily~Metadata_Reload -> Dedicated task created to run the metadata load only. I always run it before the reports, and it has a specific logic not to trigger the reports before the metadata load is finished.
  3. QNP_Smart_Report_Daily~Transaction_Report_en-US_Daily_EXCELtoFTP -> It triggers the Transaction_Report_en-US_Daily_EXCELtoFTP QNP task. Output Excel file to sFTP.
  4. QNP_Smart_Report_Daily~Transaction_Report_en-US_Daily_CSVtoFTP -> It triggers the Transaction_Report_en-US_Daily_CSVtoFTP QNP task. Output CSV file to sFTP.

Here is the trick. The ~ is the delimiter for the QNP App Name (first part in the app name before the ~), and the second part is the QNP Task Name.

This way, using the QS app name, you can "send" parameters to your QS app script and build a generic script.

It might be difficult to grasp all the details with such a simple explanation, but I can assure you there is a solution for this, not as elegant as I expected, but when if structured, it works well and gives you a lot of flexibility.

Let me know if I can be of any help or if you're able to figure out the whole picture.

Regards,

Huberto

Version history
Last update:
‎2024-09-23 09:40 AM
Updated by: