Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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.

  1. When I set the variable first & then run the macro, it works fine.
  2. 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

1 Solution

Accepted Solutions
Not applicable
Author

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

SwapneelVariableSetting.PNG

View solution in original post

4 Replies
marcus_sommer
MVP & Luminary
MVP & Luminary

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

kji
Employee
Employee

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.

Not applicable
Author

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

SwapneelVariableSetting.PNG

View solution in original post

marcus_sommer
MVP & Luminary
MVP & Luminary

What has your question to do with your solution? It's far away from be the same ...

- Marcus