
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unable to set variable using macro or Set variable
Hi,
I am trying to run a macro & set a variable, both the actions in one button,one after the other @ a single click.
- When I set the variable first & then run the macro, it works fine.
- but when I run macro first & then set variable, only the macro executes & variable setting doesnt takes place.
In the access point with the (1) approach when I set variable & then run the macro, both the events take place & after a couple of seconds of time the variable resets itself.
Can anyone please explain this unstable behaviour ?
I have attached the file for reference which consits a button named "Hello" which is shown & hidden when the other buttons are clicked,
Qlikview version 11.2
Thanks in Advance
Regards
Swapneel
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi folks,
Thanks for your quick replies
@John Idh: I tried setting the value of variable using macro also, still it results in same.
Actually when a reload or a partial reload takes place, the values of the variables gets reset.
Solution: In the qvw, go to the document properties, in the Variables tab, selecting each variable, check the check box saying 'Include in Bookmarks'
Plz refer attached image.
Thanks & Regards
Swapneel


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your code set values to an exists variable but creates none - therefore the attempt to set a value to a not exists variable must fail - you could create a new variable with such a statement:
ActiveDocument.CreateVariable "MyVar"
- Marcus


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The actions in the list are started in the order given, but not necessarily finished in that order.
I'm guessing the SetVariable action is very quick to execute whereas starting a macro contains a lot of overhead which leads to the SetVariable being finished before the macro.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi folks,
Thanks for your quick replies
@John Idh: I tried setting the value of variable using macro also, still it results in same.
Actually when a reload or a partial reload takes place, the values of the variables gets reset.
Solution: In the qvw, go to the document properties, in the Variables tab, selecting each variable, check the check box saying 'Include in Bookmarks'
Plz refer attached image.
Thanks & Regards
Swapneel


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What has your question to do with your solution? It's far away from be the same ...
- Marcus
