Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Peter_Cammaert
Partner - Champion III
Partner - Champion III

ErrorMode 0 blocks script errors from Connectors?

Apparently, the tried and tested ErrorMode technique for intercepting error handling in a QlikView load script doesn't work when using a Connector to stream data from an external source.

When dealing with ODBC/OLEDB connections or loading data from a QVD, this usually performs very well:

SET ErrorMode = 0

Test: LOAD Dummy FROM abc.qvd (qvd); // Doesn't exist

LET vError = ScriptError; // vError now contains the error details to be acted upon

SET ErrorMode = 1; // Restore default handling

Unfortunately, when using a Connector no more error details are passed to the script when ErrorMode equals 0. It seems as if everything is wiped out, and only a text message is printed to the log/progress window. Setting ErrorMode back to 1, the script interupts at the first Connector failure so some communication must be happening...

My case centers around the SAP Connector, because I would like to make a table extraction that occasionally fails restartable. No luck so far. The script engine isn't even aware that something went wrong.

Anyone has an idea how to handle this without QV taking over Does anyone have the same experience when using another Connector?

Peter

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III
Author

I found a workaround.

Indeed, ScriptError and ScriptErrorDetails won't receive any information when a Connector encounters an error. But to my suprise, both ScriptErrorCount and ScriptErrorList will be updated with (partially) relevant information. ScriptErrorCount will be incremented and ScriptErrorList will receive a new text string "General Custom Database Error".

Well it's better than nothing. More so because both variables can be reset before custom error handling is going to take over. That way, there will be only one value to check, and one message to display.

Code like this can be used to handle Connector errors in a customised way:

SET ErrorMode = 0; // We take over from here

LET ScriptErrorCount = 0;

LET ScriptErrorList = '';

CUSTOM CONNECT TO ...;

SQL SELECT ...; // Perform some DB operation through this connection

IF ScriptErrorCount > 0 THEN

  TRACE >>> An error occured while reading from DB. Reason = $(ScriptErrorList);

END IF

// Retry or do whatever is necessary


SET ErrorMode = 1;

Best,

Peter

View solution in original post

1 Reply
Peter_Cammaert
Partner - Champion III
Partner - Champion III
Author

I found a workaround.

Indeed, ScriptError and ScriptErrorDetails won't receive any information when a Connector encounters an error. But to my suprise, both ScriptErrorCount and ScriptErrorList will be updated with (partially) relevant information. ScriptErrorCount will be incremented and ScriptErrorList will receive a new text string "General Custom Database Error".

Well it's better than nothing. More so because both variables can be reset before custom error handling is going to take over. That way, there will be only one value to check, and one message to display.

Code like this can be used to handle Connector errors in a customised way:

SET ErrorMode = 0; // We take over from here

LET ScriptErrorCount = 0;

LET ScriptErrorList = '';

CUSTOM CONNECT TO ...;

SQL SELECT ...; // Perform some DB operation through this connection

IF ScriptErrorCount > 0 THEN

  TRACE >>> An error occured while reading from DB. Reason = $(ScriptErrorList);

END IF

// Retry or do whatever is necessary


SET ErrorMode = 1;

Best,

Peter