Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE

Qlik Sense: fail-and-retry connection sample script

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Andre_Sostizzo
Digital Support
Digital Support

Qlik Sense: fail-and-retry connection sample script

Last Update:

May 10, 2022 3:23:50 PM

Updated By:

Jamie_Gregory

Created date:

Nov 9, 2017 12:47:56 AM

Attachments

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.

Labels (1)
Version history
Last update:
‎2022-05-10 03:23 PM
Updated by: