This solution uses QlikView macro and server-side Windows task to perform user-initiated reload from QlikView web client.
In short: create windows task on server to reload the qvw; create button in document to run the windows task via macro. You also need to adjust some server settings and configure the button behaviour to be intuitive. See attached sample QVW.
- Allow macro execution on server (QMC > System > Setup > QlikView Servers > Security) –
check both options „Allow macro...“ and „Allow unsafe macro...“
- Enable Batch Mode in QV Distribution Service settings:
Edit the file C:\Program Files\QlikViewServer\Distribution Service\QVDistributionService.exe.config –
find the line <add key="EnableBatchMode" value="false"/>
and set it to "true". After that restart distribution service.
- Create a .BAT file with reload command. For example:
"C:\Program Files\QlikView\Distribution Service\QVDistributionService.exe" -r="C:\QlikView\Live\MyDoc.qvw"
- Create Windows Task that executes the BAT file:
- Run with highest privileges
- Run whether user is logged on or not
- No triggers
- Action - Start a program: C:\QlikView\System\Reload_MyDoc.bat
- Settings: Allow to be run on demand; If already running > Do not start a new instance (this will avoid multiple users reloading at the same time)
- Ensure that the user account of the task has „Log on as a batch job“ rights in Local Security Policy > Local Policies > User Rights Assignment
- Test if the task works
- Add the reload macro to the qvw:
'Starts Windows Task called "QlikView Reload MyDoc" in QVS host server
'Task start is called by qlikview service account
Set oShell = CreateObject ("WScript.Shell")
oShell.run "schtasks /Run /TN ""QlikView Reload MyDoc"" "
- Create the reload button in your QVW and assign it two actions:
a) Set Variable vReloadStarted =Now()
b) Run Macro ’user_reload’
Finally configure the button’s behaviour: it shoud be disabled after press and re-enabled after reload completed. For this create a variable vReloadStarted. This variable will get now() value when button is pressed and 0 value during script reload. The button is enabled only when value is 0. The button shoud be enabled only in browser mode (not in desktop). There is also some dynamic text and help text to ensure best user experience, see attached QVW.
- This „batch mode reload“ bypasses the QMC, so it is not logged in QMC and no alerts are sent on failure.
- Due to nature of web/ajax client, the button text is not updated automatically when reload is complete. User has to click somewhere in the sheet or refresh browser window to check current state.