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

Announcements
Qlik Unveils New Agentic Capabilities Across Analytics, Data Engineering, and Trust: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
2 Replies
Chanty4u
MVP
MVP

You can try this ways

Reload Logs

Data connection page

Test reload script with TRY/CATCH

SrinithiS
Contributor II
Contributor II
Author

@Chanty4u  I tried by using subroutine. Will it be effective?

SUB TestConnection(vStatusVar, ConnectionName)

// Set ErrorMode = 0 (Ignore Errors) - This is the "TRY" part
SET ErrorMode = 0;

// Reset ScriptError before the attempt to ensure we only catch errors from this run
LET ScriptError = 0;

// Attempt the connection (This is the critical step)
LIB CONNECT TO '$(ConnectionName)';

// Check if the connection succeeded, or if the last statement failed
IF ScriptError = 0 THEN
// If ScriptError is 0, the last statement (LIB CONNECT) succeeded.
// Set the status variable to 'OK'
LET $(vStatusVar) = 'OK';
TRACE 'Connection OK: $(ConnectionName)';
ELSE
// If ScriptError is non-zero, the LIB CONNECT failed. Keep the default 'FAILED' status.
TRACE 'Connection FAILED to $(ConnectionName). Error Code: ' & ScriptError & ' - ' & ScriptErrorDetails;
ENDIF

// Reset ErrorMode to 1 (Stop on Error) for the rest of the script
SET ErrorMode = 1;

END SUB

// 1. Initialize Status Variables
Let vOracleStatus = 'FAILED';

CALL TestConnection('vOracleStatus', 'connection Name');

ConnectionMonitor:
LOAD * INLINE [
Connection Name,Data Sources,Status

];