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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
jackm75
Creator
Creator

How to display error message on button reload?

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? 

 

 

Labels (2)
1 Solution

Accepted Solutions
jackm75
Creator
Creator
Author

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)'
)

View solution in original post

3 Replies
Chanty4u
MVP
MVP

You can try something like below

=If(ErrorCount > 0, 'Load script error: ' & ErrorText)

 

jackm75
Creator
Creator
Author

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? 

jackm75
Creator
Creator
Author

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)'
)