Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all, after searching I cannot seem to find an answer. I have an app with a button that allows users to reload an app on Qlik Cloud. The issue is if the reload fails due to an error, there is no indication to the user making them aware of the error.
How can we capture a load script error and display the error details to the user within a text box on a sheet?
Here's what I was able to get to work:
In the load script Set ErrorMode=0;
After each section that has a potential to fail, added:
Set vCustomErrMessage = '$(ScriptErrorDetails)';
IF $(ScriptErrorCount) >= 1 THEN
Exit Script; //since errmode 0 will continue, I want to exit if there is an error
END IF
In the sheet text box added:
=
If($(ScriptErrorCount) >0,
'Error Message: ' & '$(vCustomErrMessage)'
)
You can try something like below
=If(ErrorCount > 0, 'Load script error: ' & ErrorText)
Thanks for the reply, but that isn't working for me. Note that I also tried using the variables ScriptErrorCount, ScriptError, ScriptErrorList and ScriptErrorDetails.
When in debugging mode, I can see that ScriptErrorCount = 1; ScriptErrorDetails has value. However, it's not showing up in the text box on the sheet. In the box, ScriptErrorCount is 0 and the others are empty. So, it seems it's not saving the variable values after load fail. Is this perhaps a limitation on SaaS (Cloud) vs Windows?
Here's what I was able to get to work:
In the load script Set ErrorMode=0;
After each section that has a potential to fail, added:
Set vCustomErrMessage = '$(ScriptErrorDetails)';
IF $(ScriptErrorCount) >= 1 THEN
Exit Script; //since errmode 0 will continue, I want to exit if there is an error
END IF
In the sheet text box added:
=
If($(ScriptErrorCount) >0,
'Error Message: ' & '$(vCustomErrMessage)'
)