
Digital Support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Qlik Sense: fail-and-retry connection sample script
Last Update:
May 10, 2022 3:23:50 PM
Updated By:
Created date:
Nov 9, 2017 12:47:56 AM
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.
2,249 Views