There are situations when you want your document to be permanently opened and auto reload without the help of QlikView server.
To do that we need the auto reload macro and a trigger. The macro looks like that:
Sub ReloadDoc ActiveDocument.Reload ActiveDocument.Save End sub
As trigger we will use a variable that checks the difference between current time and last reload time. We will add an action on Onchange event of that variable, action that will run our macro.
So, add a vTriggerReload variable with the following expression:
=if((Now()-ReloadTime())*1440 >= 10, vTriggerReload+1, 0)
Go to Settings -> Document properties -> Triggers tab:
- In “Variable event trigger” box, select vTriggerReload variable and press the “OnChange” -> “Add action(s)” button.
- In the “Actions” window that popped up press the “Add” button, select “External” action type, “Run macro” action and press “OK”.
- Write “ReloadDoc” in “Macro name” box and press “OK” buttons all the way.
You may have to run the first reload, since QlikView doesn’t recalculate anything until a user action is recorded.
In the end, we have to force QlikView to do the initial reload because it doesn’t calculate anything if no change is recorded. So, in the same “Triggers” tab from document settings, we add a “Run macro” external action on “OnOpen” document event.
Tip: seems that variables are not always recalculated if there’s no object to use them. A hidden textbox which calls the “TriggerReload” variable can help in forcing QlikView to do the refresh.