How to use Subversion with QlikView tutorial

Coming from basic programming where you write every line of code yourself and collaborate with a lot of people in the same project. It becomes completely mindboggling that no one uses version control software with QlikView.

Many applications are super simple, so one might argue this is overkill. But QlikView is moving into the enterprise, and changes are made often, so proper version control and collaboration quickly because a most. At least to avoid the most common mistakes like overwriting others code.

No version control software is any good at handling binary files. And we been asking QlikTech to separate code and data for a long time, but since this is not the case we need to version control it somehow. I won't go into details about how to structure your script so that you can version control it better.

But I'm am going to let you in a little secret trick that I have discovered. The binary QlikView files can often be in the gigabytes. And commiting them is kind of a killer not only for your network but also for your subversion server. So what I do is empty them before I commit them.

SVN or CVS allows you to run a hook, before doing a commit (pre-commit). So what I have done is write a script that uses QlikView to empty the .qvw files and save them into another directory, which then is committed. Its a 2 part script. The first script loops a directory. This is easily done in regular command line. And parses the files with .qvw to another script called qv-nodata.vbs.

set QV=C:\Program Files\QlikView\qv.exe

set Home_path=D:\svn
set Master_home=%Home_path%\QlikView\Master
set Repos_home=%Home_path%\QlikView\MasterRepos
set Hook=%Home_path%\QlikView\Scripts\qv-nodata.vbs

for /F "tokens=*" %%a IN ('dir /b %Master_home%\*.qvw') 
do ( call cscript "%Hook%" "%Master_home%\%%~a" "%Repos_home%\%%~a" )

REM pause

The other script uses the OCX object to create a new QlikView instance, for this I need Visual Basic, without data and then save it to another location:

docpath = WScript.Arguments.Unnamed(0)
savepath = WScript.Arguments.Unnamed(1)

set qv = CreateObject("QlikTech.QlikView")
set objDoc = qv.openDocEx(docpath,0,false,"","","",true)
objDoc.SaveAs savepath
objDoc.GetApplication.Quit

Add this as a "pre-commit hook" in your svn settings.

D:\svn\QlikView\Scripts\qv-hook.bat

and when you select commit a few QlikView windows will pop up and when you are done, you simply select the empty files you want to commit. And no this will not work on linux ;) Its dead easy!

Интересно написано, мне

Интересно написано, мне понравилось однако.

but why committing binary

but why committing binary files instead of the xml generated by the "export layout" command ?

Because the xml is ill suited

Because the xml is ill suited for daily work. I have a separate script than used to pull out the xml and store that ass well, but we seldom used it - so we more or less abandoned it.

Include?

Have you thought about using $(Include =myfile.txt) and putting the code in that file instead?

We also do that. This is just

We also do that. This is just for handling the binary files.

Hello, Thanks for posting the

Hello,

Thanks for posting the article about automatic QlikView data reduction in a  Subversion pre-commit hook.

After reading your article I did some more reading on repository hooks in Subversion. The authors of the Subversion book (http://svnbook.red-bean.com/, chapter 5) advise users _not_ to alter the files that are checked in using a hook script. From the description in chapter 9 (under 'Repository hooks') I'd guess a start-commit hook is safer in your case than a pre-commit hook, because the transaction hasn't even started yet (and will only start after you've finished altering the QVW). This way you can guarantee that the local 
'pristine' copy (which should be exactly the same as the latest version in the repository) is actually exactly the same as the latest version in the repository.

Too bad the use of Subversion only fixes the 'what was in the previous revision' problem; there's a (slow) discussion in one of the partner forums on QlikCommunity about using QlikView in multi-developer scenarios (which requires merging different versions - currently always by hand).

With regards,
Martijn ter Schegget
CND Development

Hi Martijn,  I'm aware of

Hi Martijn, 

I'm aware of this. But I do save the nodata version in another directory and never touch the original version. I need to do this because else you won't be able to see what you can commit in the commit list. The pre commit runs before the list of commitable files in created. On the master folder I have set a svn ignore, so svn does not look at the files.

I now its a bit nasty, but this is the only way for now.

Regards Seebach

have to try that out

Hi Torben,

thanks for sharing this information, i have to try this out. we are fiddling around a bit with extracting xml files from qvw document - and storing them into subversion, but did this alltime now by hand.
I will try that out in inserting our "store-to-xml" macro in your hook it into subversion and clear data batch.
btw have you ever tried this with hidden scripts and access restrictions?
i have had bad experience with deleting all data, will delete the access tables also and thus allow noone into the document for reload.

Regards,
Christian

http://www.schlettig.de/blog/

QlikView version control

Hi guys,

You might want to check-out www.noadbi.com. They have released a new version of their Version Control and deployment application that works integrated with QlikView yesterday. I'm planning to meet them at Qonnections next week. Sounds interesting...

EQ4M

It does, but reading the features it does nothing more than the above except being more streamlined. What I like is to be able to se what change actually has been done. They appear only to support that a change has been done!