Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
stabben23
Partner - Master
Partner - Master

Run Macro from trigger/selection

Hi,

Cant find a smart way to fire my macro "RefreshData". I have a macro that needs to be fired from inside Application.

I have variables vSecond =second(now(1)) , vReload= if($(vSecond)>50,1,0)

So when my vReload is 1 it should  fire the macro.

Any actions the fits my requirement? I have test some but without success.

13 Replies
sinanozdemir
Specialist III
Specialist III

Hi,

Have you looked into "Variable Event Triggers" in Document Properties?

Capture.PNG

You may be able to accomplish what you need to, with this.

Hope this helps.

stabben23
Partner - Master
Partner - Master
Author

Hi Sinan,

yes, i have struggeling With that, But no success. My variable vReload changes to 1 when 50 second on systemclock.

So far so good, but now I have to in some way fire my macro who is inside "Edit Module".

sinanozdemir
Specialist III
Specialist III

Are you using "Run Macro" action from the external action type? If so, just grab the Sub/Macro name and place it into the box shown below:

Capture.PNG

I hope I understood your problem correctly.

stabben23
Partner - Master
Partner - Master
Author

Hi Sinan,

I can not have the trigger on Document Level OnAnySelect, when the variable becomes 1 it should trigger the macro.

I look for: variable=1, Select a Field and that Field triggers the macro or if the variable itself can trigger the macro.

You can test this by doing a variable like this if(now(1)>50,1,0)  1 run macro.

stabben23
Partner - Master
Partner - Master
Author

trigger.GIF

Here is my requirement, is it possible to Select Field Refresh With my Variable? Variable becomes 1 when Seconds >50. When this happens, Select Refresh. If my Field Refresh get selected I can add a Field Event trigger to run my macro.

tamilarasu
Champion
Champion

Hi Staffan,


I am not sure what is the purpose of reloading the dashboard every 50 seconds. I think, it's not a good idea. What If your dashboard takes more than 50 seconds to load all the data.?  So I will not suggest to reload on every 50 seconds.

I have attached one solution, since you asked. I just used "Variable Event Trigger" option. If you have any questions, Let me know.

stabben23
Partner - Master
Partner - Master
Author

Thanks Tamil,

I'll check this very soon, 50 sec is just for test, I think I'll use every second minute instead. The application itself takes around 30 sec to reload.

stabben23
Partner - Master
Partner - Master
Author

Tamil, I'm confused here. It Works as expected in Your Application but not in my QV12 SR5. What Version have you build it in?

tamilarasu
Champion
Champion

Staffan,

I am using 11.20.XXXX.  If my sample works in your desktop, then it should work in your file as well. Did you follow the same procedure.?