Command line statement from QV Publisher

Steve Dark has recently created askQV.com where you can search several QlikView blogs and the QlikCommunity.  It’s a great resource and I congratulate Steve for his initiative.

It’s not uncommon that I found a solution to a problem only to forget it and then not know where to find it again when I need it in the future.  How to run a command line statement from QV Publisher is one of those infrequent questions that has no clear solution in QlikCommunity, and after performing a search on askQV.com, apparently nobody has blogged about it either.

If you have QlikView Publisher and you go to the System (1) tab of the QlikView Management Console there will be a link to Supporting Tasks (2).  If you then click on External Programs (3) you can then create a command line statement.

ExternalProgramQVPublisher

The most common reason that you might want to run a command line statement is to copy and rename a QVW file that then is reloaded independently from the first QVW file.  This can help you avoid creating multiple QVW files with the same reports so that all have to maintained manually.

For example, I create a QVW file with the following script to create one QVW with only file security and another with section access.  In this way I can avoid disabling strict exclusion which may allow some section access users to view all the data.

Binary [sales_model.qvw];

let vFileName = subfield(DocumentName(),’.’,1);

if vFileName= ‘Sales_SA’ then

     Section Access;

     LOAD
          ACCESS,
          NTNAME,
          _IDSALESPERSON
     FROM [QVDs\Section_Access.qvd] (qvd)
     Where 1=1;

     Section Application;

endif

Once the sales model is reloaded using QlikView Publisher, you can run a command line statement to copy and rename the QVW file.  A QlikView distribution task will not work because it does not copy the script of the QVW file it distributes.

You can run a command line statement using the External Program task in QV Publisher.  The most difficult step in creating this task is the actual command line statement.  After a lot of testing the following command line statement worked for me.

 C:\Windows\system32\cmd.exe /c copy /y “\\servername\C\QVDocs\Sales.qvw” “\\servername\C\QVDocs\Sales_SA.qvw”

After that task is complete each QVW is reloaded separately.

I’ve also done this to copy and reload the same QVW with different data models of varying granularity.

Hope to see you around,

Pover

 

Author: Karl Pover

Owner of Evolution Consulting, which provides Qlik consulting services throughout Mexico. Author of "Learning QlikView Data Visualization" and "Mastering QlikView Data Visualization." Qlik Luminary since 2014.

2 thoughts on “Command line statement from QV Publisher”

  1. Hi Karl, Many thanks for the mention of AskQV here. It seems to be prompting a number of people to write new blog posts.

    To take your technique of running batch tasks from Publisher a step forward, you could combine that with writing the batch file on the fly, using the STORE statement as I mention in my latest blog post; http://bit.ly/Sc9Cbp

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: