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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Bizarre behaviour setting variables - different in debug mode

I'm having a problem with different behaviour in debug mode, compared to test mode in a VBScript module.

When the user logs in, I have a couple of triggers that check the username, and then decide on the basis of some settings in a 'security' table whether or not a particular sheet should be visible.

There are variables for each sheet v(sheetname)Visible v(sheetname)Sample that get set and the sheets are set up to show conditionally based on the values in the variables.

When the code runs on start up, it is not correctly setting one of the variables. If I go into the module editor and run the checkVisibleSheet macro in test mode, it also sets the variable incorrectly. However, if I set a break point and step through the variable setting routine manually in debug mode, it works correctly!



Any clues - I'm tearing my hair out!!!

6 Replies
Anonymous
Not applicable
Author

Maybe it's timeing issue... Try to insert this line before/after setting the variable:
ActiveDocument.GetApplication.WaitForIdle

Not applicable
Author

Thanks for the suggestion - it does look like something like that. However, sprinkling those around doesn't seem to make a difference, but I will persevere!

Anonymous
Not applicable
Author

You can also try "sleep":
ActiveDocument.GetApplication.Sleep 1000 ' 1 second

Not applicable
Author

Thanks - I have tried some minor recoding and the initial problem seems to have gone away, so I'm keeping everything crossed....

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Also, keep in mind that certain QlikView APIs are not available when the macro is running "OnOpen"...

Ask me about Qlik Sense Expert Class!
Not applicable
Author

Just a note that the .waitforidle script items caused a lot of probems with the Ajax version, although this was not obvious running from the client.