Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

chris_johnson
Not applicable

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

1 Solution

Accepted Solutions
rbecher
Not applicable

Re: Testing a connection

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!

3 Replies
rbecher
Not applicable

Re: Testing a connection

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!

chris_johnson
Not applicable

Testing a connection

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
Not applicable

Testing a connection

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