When connecting to a data connection, the developer may want to set up fail-and-retry logic. When the main connection fails, a backup connection is used.
How to achieve it?
Resolution:
Setting errormode to 0 can force the script to continue after a failure.
The code will look like this:
//Suppress reload failure in case of connection failure
Set errormode = 0;
//Connect to the main Connection
LIB CONNECT TO 'MainConnection';
//Evaluate error code
LET tempErrorDetails = ScriptErrorDetails;
IF Len(tempErrorDetails) > 0 THEN
// If there is an error connecting to this connection
trace ERROR: $(tempErrorDetails);
LIB CONNECT TO 'backupConnection';
End If
//Resume error mode
Set errormode = 1;
// Load Script Start
// Load Script End
// Disconnect
DisConnect;
Sample QVF is also attached. Please modify the sample code in it accordingly before using.