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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
chris_johnson
Creator III
Creator III

Testing a connection

Hi all,

I've been having a scout around the forum but haven't found anything yet. Hopefully someone can tell me if this is possible...

Can you test a connection within QlikView script? I am having the problem that with a multi-database solution that one of the databases may be taken offline for some reason but this will crash the reload. Is there anything I can do about it?

Thanks,

Chris

Labels (1)
1 Solution

Accepted Solutions
rbecher
Partner - Master III
Partner - Master III

Hi Chris,

may you can catch the ScriptError:

set ErrorMode=0;

CONNECT ...;

if ScriptError=9 then   // or ScriptError > 1

     //no connect...

end if

set ErrorMode=1;

- Ralf

Message was edited by: Ralf Becher Thanks for the hint Chris!

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine

View solution in original post

3 Replies
rbecher
Partner - Master III
Partner - Master III

Hi Chris,

may you can catch the ScriptError:

set ErrorMode=0;

CONNECT ...;

if ScriptError=9 then   // or ScriptError > 1

     //no connect...

end if

set ErrorMode=1;

- Ralf

Message was edited by: Ralf Becher Thanks for the hint Chris!

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
chris_johnson
Creator III
Creator III
Author

Hi Ralf,

That's great! I'll have a play around with ErrorMode and ScriptError and I'm sure I'll come up with something. Can't say I've been aware of these in the past but I'll be sure to make a note of them and use them in the future.

Thanks a lot,

Chris

chris_johnson
Creator III
Creator III
Author

Got it working. Although looking at the help file for ScriptError it says that 1 = No Error. So I have amended the line to be:

if ScriptError > 1 then ...

This works now, thanks for your help.

Chris