QlikView – Backup No Data with PRJ folder content to TFS


Working in Qlikview, would bring you across files which are gigantic and balloons up in your RAM once loaded (depending on the data set loaded in them).

But its an amazing technology and the power it enables business user to so quickly slice-dice the data which are inter-related.

All things good about Qlikview, but then comes the developer problems !!

“I have a nice beautiful Qlikview application, how do I source control it to follow the norms of development.”

Well the important points relating to Qlikview that came across my experience are:

  • Never check-in the data loaded Qlikview application
  • Always check-in Qlikview application with its corresponding “prj” folder, which contains all the internal information of your Qlikview application and easier for change tracking

Now the rules laid out, time for scripting the code that achieves the above and prepare our Qlikview check-in folder for TFS where the QVW files are no-data and associated PRJ folder is present.

Note: The below is a powershell script, and in order to run the below you need to have Qlikview application installed on the machine

function QV-NoDataSaveAndClose-QVW

 #--Open the file intially to save the document in new location
 $NewDoc = $qvComObject.OpenDocEx("$QvwPath",1,'false', '', '', '','true')




 #--Open the file second time to generate the sourcecode checkin files
 $NewDoc = $qvComObject.OpenDocEx("$QvwSavePath",1,'false', '', '', '','true')





function GetFileNameFromPath{
    return [System.IO.Path]::GetFileName($filePath)

#-- ** Copy the source files via backup script ** --

$srcFolder = "C:\QvwApp\SourceFolder"
$dstFolder = "C:\tfs\DestFolder\"

#-- Clear the destination folder
Get-ChildItem -Path $dstFolder -Include * | remove-Item -recurse 

#-- Open the QV Application
$qvComObject = new-object -comobject QlikTech.QlikView

$srcFiles = Get-ChildItem -Path $srcFolder -include ('*.qvw') -Recurse

foreach ($sFile in $srcFiles) {
    $srcFile = $sFile
    $srcFileInfo = Get-ChildItem $srcFile
    $dstFile = $dstFolder + $srcFileInfo.BaseName + $srcFileInfo.Extension
    $dstPrjFolder = $dstFolder + $srcFileInfo.BaseName + '-prj'

    #-- Create a prj folder for each file for source code archival
    New-Item -ItemType Directory -Force -Path $dstPrjFolder
    #-- Open the file in QV app with NoData and save
    QV-NoDataSaveAndClose-QVW $srcFile $dstFile

#-- Close the QV Application


#-- ** Copy the code folder from source ** --

$srcCodeFolder = "C:\Src\LoadScript"
$dstCodeFolder = "C:\tfs\LoadScript"

Copy-Item -Path $srcCodeFolder -Recurse -Destination $dstCodeFolder -Container

Now once the above script is executed, the configured destination folder will have the QVW files which resided in the source (as no-data saved) hence they will be substantially small in size with their named corresponding PRJ folder containing all the internal structure of QVW application.

Then this destination folder can be checked-in to any source control of your choice.

The additional link can help you work out the use of prj folder in association with Qlikview document:
Prj Folder in QlikView

Hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *