Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I try to setup my QlikView script to switch between two OLEDB Connection Strings via a external file.
Storing my Connection Strings in two different qvs files (CONNECTION_SQL_TEST.qvs and CONNECTION_SQL_PROD.qvs)
Loading the file text file that contains the Instance Name (TEST or PROD) and write a variable called vSQL_INSTANCE. In this variable it will be simply stored 'TEST' or 'PROD'
Tried to create a condition like this:
if($(vSQL_INSTANCE)='TEST'
,
$(Include=$(path_toggel)CONNECTION_SQL_TEST.qvs);
,
$(Include=$(path_toggel)CONNECTION_SQL_PROD.qvs);
)
Result -> Syntax Error.
Could anymody help me with that?
Is it actualy possible to use a if condition in combination with Connection Strings?
Thank you for your efforts.
Kind Regrads
Philipp
Dont try to do it in an expression. Use this:
If vSQL_INSTANCE = 'TEST' Then
$(Include=$(path_toggel)CONNECTION_SQL_TEST.qvs);
Else
$(Include=$(path_toggel)CONNECTION_SQL_PROD.qvs);
End If
if($(vSQL_INSTANCE)='TEST'
,
$(Include=$(path_toggel)CONNECTION_SQL_TEST.qvs)
,
$(Include=$(path_toggel)CONNECTION_SQL_PROD.qvs)
);
Hi Rodrigo,
thank you for answering, but this is also not working "Script Error - Unknown statement" ...
I think the Syntax is still wrong, or maybe it is not possible to combine if withOLEDB CONNECT TO ??
Kind regards
Philipp
Dont try to do it in an expression. Use this:
If vSQL_INSTANCE = 'TEST' Then
$(Include=$(path_toggel)CONNECTION_SQL_TEST.qvs);
Else
$(Include=$(path_toggel)CONNECTION_SQL_PROD.qvs);
End If
Or you could try this:
$(Include=$(path_toggel)CONNECTION_SQL_$(vSQL_INSTANCE).qvs);
(BTW - I would use $(must_include=...) for a connection string so that the script fails at the right place if the include file cannot be found)
Thank you so much.
This solved my problem.
Kind regards
Philipp
Good idea!! 🙂
That was not my intention, but works anyway.
Thank you 🙂