1 Reply Latest reply: Jan 22, 2018 8:58 AM by omar bensalem RSS

    How to handle connection Errors in Qlik

    omar bensalem


      Hi folks, as obvious with its title, we'll discuss in this thread a simple method to handle some errors in Qlik.

      photodune-6426830-error-xs.jpg

      To explain today's aim in better words , we sometimes, due to some performance issues, have throwns errors while trying to connect to our source (especially when it comes to Web Services... that was the case for me unfortunately !)
      But, when I try to connect again, the connection is made..

      So basically, sometimes, if we wait a little bit, and try to perform the connection again, it works... (strange, but true !)
      With that in mind, and as Qlikers know, in case of an error, Qlik will automatically stop the data reloading process.. and thus, the application won't be reloaded due to a performance issue...

      Now just imagine, that this was a nearly every day thing, and so, each day, you'll be surprised by the failure of the reloading task of your application (due to performance issues) and having to face angry emails from users not happy with the application not up to date... Yeah, not the best way to start a day !

      But, every problem has its solution; and the best way to counter this one, is to handle this error the right way.
      So basically, instead of having an error, It would be better to automatically try to connect again and again untill the connection is made. With that, we'll be sure the application is reloaded and that users are happy.

      How to?img-preventablecauses-ITdowntime.png

      No, not like that but instead?
      => A combination of ErrorMode and scripterror

      LET ErrorMode=0; //With this, Qlik won't kill the reloading process if there is an error

      Load * from yourSource; // try to connect to ur source and import data

      if ScriptError >0 //if there an error

      then

      for vLoop=1 to 10
      sleep 5000; // wait 5 seconds and try to reconnect untill the connection is made
      Load * from yourSource;

      if scripterror=0 then //if there is no error, we don't try to reconnect
      exit for
      EndIf
      Next
      EndIf
      LET ErrorMode=1; //roll back to the normal Qlik's behaviour when It comes to handling errors

      Hope that was helpful !

      How to handle connection Errors in Qlik by Omar BEN SALEM. | LinkedIn