Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW

Simple user reload button in QlikView web client (without IE Plug-in, EDX, IIS or Extension)

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
tanelry
Partner - Creator II
Partner - Creator II

Simple user reload button in QlikView web client (without IE Plug-in, EDX, IIS or Extension)

Last Update:

Dec 1, 2017 3:26:32 AM

Updated By:

tanelry

Created date:

Dec 1, 2017 3:26:32 AM

Attachments

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.

Setup:

  1. Allow macro execution on server (QMC > System > Setup > QlikView Servers > Security) –
    check both options „Allow macro...“ and „Allow unsafe macro...“

  2. 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.

  3. Create a .BAT file with reload command. For example:
    "C:\Program Files\QlikView\Distribution Service\QVDistributionService.exe" -r="C:\QlikView\Live\MyDoc.qvw"

  4. 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

  5. Add the reload macro to the qvw:
    sub user_reload
    '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"" "
    end sub

  6. 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.

Notes:

  • 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.
Comments
syukyo_zhu
Creator III
Creator III

Good work.

Thanks for sharing your document.

It works perfectly

0 Likes
tanelry
Partner - Creator II
Partner - Creator II

Glad to hear that!

Best regards,

Tanel

0 Likes
syukyo_zhu
Creator III
Creator III

How can I use a variable in your solution? For example, I select November 2017 in my application and I need to just reload data for November 2017.

I check out command schtasks /run, it seems that I cannot add a more parameters to the command.

Best regards

0 Likes
tanelry
Partner - Creator II
Partner - Creator II

You can expand macro to export the variables into a text file before the reload command.

Then pick it up in the reload script.

Example of export into txt file via macro:

set table = ActiveDocument.GetSheetObject("CH10")

table.ServerSideExportEx "C:\QlikView\System\Reload_Parameters.txt" , ";" , 1, 1257

The load script probably needs some additional logic to distinguish between "user reload" and "regular reload". For this you may pass additional variable vUserReload = 1 from the BAT file:

"C:\Program Files\QlikView\Distribution Service\QVDistributionService.exe" -r="C:\QlikView\Live\MyDoc.qvw" -variablename=vUserReload -variablevalue=1

0 Likes
richnorris
Creator II
Creator II

Hi, I'm having some trouble with this, I've performed step two:

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.


but when I run my .bat file it gives the error:

21/09/2018 00:14:48     Information     Setting RunLevel to Batch

21/09/2018 00:14:48     Error   Can not run in batch mode. EnableBatchMode is set to false.

any ideas why this could be? I can clearly see in the file it says true, and I've restarted the service a couple of times now, it still isn't registering it?

0 Likes
tanelry
Partner - Creator II
Partner - Creator II

What's your setup - single or multiple QVS instances, with or without publisher?

0 Likes
nigel987
Creator II
Creator II

hi, I've done as advised (in Step 4 the task works as expected).

but when I press the reload button in the IE client or in Desktop client, I just see shortly a black screen popping up and disappearing, and reload does not work. 

single instance, no publisher, any hint what I am doing wrong?

KR

José_Espinoza
Partner - Contributor III
Partner - Contributor III

Is there a way to make this work in the desktop version when I'm connecting to a server? This solution only works in AccessPoint.

0 Likes
Version history
Last update:
‎2017-12-01 03:26 AM
Updated by: