Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
Background:
I develop QVW on my local machine then upload them on Production server so users can use it via Access point.
But every-time I copy the file from my machine to the server.. I have to change the connection string.
I have created a variable in the beginning of the load script as below :
vEnvironment = 'Dev' ;
What if statement should I use in the load scrip so that if vEnvironment = 'Dev' then it should use DEV OLEDB connection string and if its 'Prod' then it should use Production OLEDB connection string
For that Create the Variable in each root folder application.
For dev application, create the, Variable, vDev=1
For UAT application, create the, Variable, vUAT=1
For Prod application, create the, Variable, vProd=1
Now in each application write the below Condition
If $(vDev)= '1' Then
CONNECT ... <dev connect string ...>;
Else if $(vUAT)= '1' then
CONNECT ... <UAT connect string ...>;
Else if $(vProd)= '1' then
CONNECT ... <Prod connect string ...>;
End If
You can open the connections condionally:
If vEnvironment = 'Dev' Then
CONNECT ... <dev connect string ...>;
Else
CONNECT ... <production connect string ...>;
End If
Or you can use an include file with the connect string. One file in the same relative location to the qvw file on each server containing the connect statement with the connection string for that environment.
Thanks Jonathan,
Can we add two if conditions if I add another environment in between like 'Testing' or 'UAT'
And What could be the other alternatives for changing connection dynamically based on the QVW document root?
I mean, If the document root folder name wild match = 'Test' then connect to test or dev accordingly?
For that Create the Variable in each root folder application.
For dev application, create the, Variable, vDev=1
For UAT application, create the, Variable, vUAT=1
For Prod application, create the, Variable, vProd=1
Now in each application write the below Condition
If $(vDev)= '1' Then
CONNECT ... <dev connect string ...>;
Else if $(vUAT)= '1' then
CONNECT ... <UAT connect string ...>;
Else if $(vProd)= '1' then
CONNECT ... <Prod connect string ...>;
End If
Another option is to put the connect command in an INCLUDE file, with the relevant connection settings on Dev and Prod.
Then add a MUST_INCLUDE statement to access the relevant connection details.
I have a similar solution to a different problem and use my machine name to resolve which data folders the script looks at when loading data :
if ComputerName() = 'MACH004' then
Set Path = '..\Sources\';
Set Store = '..\Backlog History\';
else
Set Path = 'D:\QlikView\01 Development\06 Web\Data\';
Set Store = 'D:\QlikView\01 Development\06 Web\Store\';
End If