I would like to know good recipe for that scenario too. We too keep our QDF projects in CVS (git).
My current approach is to group all environment specific variables in one file and to include that file in .gitignore
So that one file we have to edit and maintain separately for each site.
Not good solution but I have no better one.
Jonas Wiklander ( community.qlik.com/people/jonas.wiklander ) have written a series of blog posts on the topic QlikView and version control. I found it interesting and worth a read if you're interested in the topic.
For that specific problem we currently switching to new solution
We introduce universal variable `vU.Environment` in our projects. If you have test, acceptance and production sites, that variable would have value 'Test', 'Acc' or 'Prod' on that sites.
Then whe use that variable in any situation where we should have separate settings for sites.
For example: if you have separate db connections at your sites you can create three files instead one connection file:
Instead of Oracle_Connection.qvs we may have Oracle_Connection_Test.qvs, Oracle_Connecion_Acc.qvs and Oracle_Connection_Prod.qvs
Then we can include it as $(must_include=(vG.ConStringPath)\Oracle_Connection_$(vU.Environment).qvs) and each site has it's own db connection.
Or we can use simple conditional code execution with `If` statement and so on.
Next question - how to manage that variable itself?
We curently have bunch of scripts that we executing just after cloning some project from repository.
So we added new script `0.Administration\6.Script\Vbs\create_environment_variable.vbs` to that initialization phase:
Const ForReading = 1 Set objFSO = CreateObject("Scripting.FileSystemObject") rootPath = objFSO.GetParentFolderName(objFSO.GetParentFolderName(objFSO.GetParentFolderName(objFSO.GetParentFolderName(Wscript.ScriptFullName)))) Set objNet = CreateObject("WScript.Network") strCompName = objNet.ComputerName envVar = "Prod" if strCompName = "OUR_TEST_MACHINE" then envVar = "Test" end if if strCompName = "OUR_ACCEPTANCE_MACHINE" then envVar = "Acc" end if Dim file path = rootPath & "\0.Administration\3.Include\1.BaseVariable\generated_environment_descriptor.qvs" set file = objFSO.CreateTextFile(path) file.Write "LET vU.Environment = '" & envVar & "';" file.close WScript.echo "Created file: " & path
That script is called from the batch file project_init.bat located in the project root directory
cd 0.Administration\6.Script\Vbs cscript create_environment_variable.vbs cscript create_sublime_project.vbs cscript create_etl_qv_apps.vbs cscript create_default_include.vbs cd ..\..\..
To set that variable we added one line in each QDF 1.Init.qvs file right below line
`exit script when '$(vG.BasePath)' = '';` see snippet:
// ADD envrironment descriptor variable $(must_include=$(vG.BasePath)..\0.Administration\3.Include\1.BaseVariable\generated_environment_descriptor.qvs);
Variable set so early in QDF bootstrap flow specifically to allow use correct value in If() functions in CustomVariables.csv files.
And obviously we added new file to `.gitignore` file, so `.gitignore` at project root now looks like:
*.qvw *.qvd !2.qvd/ *.qvw.log ~*.* *.zip *.7z *.tmp *.mdb *.ldb *.qvw.meta *.qvw.shared generated_environment_descriptor.qvs