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.
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.
let vFileName = subfield(DocumentName(),’.’,1);
if vFileName= ‘Sales_SA’ then
FROM [QVDs\Section_Access.qvd] (qvd)
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,