Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to set up a config file?

Hi,

I need to set a config file using variables  by giving all the useful information like connection string and database name etc which sits outside the qlikview and  these variables will pick up the changes automatically depending on the different environments we work like Dev,UAT and Prod.

Wondering if any one has a code how to write it.

Thank you,

Regards,

Sharma.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

1.Create a text file and save it in the folder where ur QVW exists.

2.place this sample text in that config file

     vConnName='Databasename';

     vFilepath= '...\\Data\Dev\filename';

and Save it.

3. Now include the below line in the QVW script

     $(Include=Config.txt);

Thats it.

Hope this helps you.

View solution in original post

5 Replies
Not applicable
Author

You could use a QVS file and a must_include directive.

A QVS is a Qlikview Script File. It works like a Qlikview Script, using the same sintax. You can set or let variables, that you can use inside you qvw. But a QVS is a Flat File that you can edit in your favorite Text File Editor, like Notepad. It's great as a configuration file.

I'm attaching a example. In Script Editor Window you can see some code that you can use to do some connection using a variable declared in QVS, like the code below:

//you can user any variable declared in qvs

//like the example below

//Set or let connectionStringVariable in qvs file

//CONNECT $(connectionStringVariable);

Anonymous
Not applicable
Author

Another Solution for this is:

Define all the variables in a notepad document and save it as a Config.txt file in the same folder where youe QVW is placed

and in the QVW

place the below script at the startting of the scripting before the actual code.

$(Include=Config.txt);

Anonymous
Not applicable
Author

Hi karthigayan,

Thanks for your reply.As i am fairly new to scripting i am a bit lost in writing the code.

All i need to do is define some  vairables that holds the path of the qvw or qvds and store that in a variable and when there is any changes in the path if i move from dev to prod , i can come to this text and change the path once and it gets reflected all across the qvws.

Can I Pick your brains,

Regards,

Sharma.

Anonymous
Not applicable
Author

Hi,

1.Create a text file and save it in the folder where ur QVW exists.

2.place this sample text in that config file

     vConnName='Databasename';

     vFilepath= '...\\Data\Dev\filename';

and Save it.

3. Now include the below line in the QVW script

     $(Include=Config.txt);

Thats it.

Hope this helps you.

Not applicable
Author

The solution above it's helpful. I think that will solve your problem.

There is a difference between include and must_include.

A include file is optional and if the included file does not exists no error will be raised and the variables will be blank or null.

A must_include is a required file. If that file not exists a error will be raised to prevent some logical mistake.

I prefer must_include. It's better to discover something wrong during the load that a number mistakes in production!