Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Is there a way to drive the OLEDB connect statement by an IF statement and variable?

I modified a script of ours to try to dynamically pick a OLEDB connect string.  I created a spreadsheet that just has 1 value in it.  Either PROD or TEST.  I read the table based off of the spreadsheet and assign the value to a variable.  I then have the following IF statement:

IF $(ServerEnv) = 'PROD' then

//PROD

OLEDB CONNECT32 TO [Provider=OraOLEDB.Oracle.1;Persist Security Info=False;User ID=wms_dw;Data Source=WMS_DWPROD;Extended Properties=""] (XPassword is PSWD);

ELSEIF $(ServerEnv) = 'TEST' then

//TEST

OLEDB CONNECT32 TO [Provider=OraOLEDB.Oracle.1;Persist Security Info=False;User ID=wms_dw;Data Source=WMS_DWPROD;Extended Properties=""] (XPassword is PSWD);

It runs and says successful but does not hit any of the code after this statement.  I did put a text object out on a page so that I could see it change between PROD and TEST and that works fine.

Any ideas?

10 Replies
maxgro
MVP
MVP

maybe you should add ' ' to $(ServerEnv) as I suggest in my previous post

IF '$(ServerEnv)' = 'PROD' then

trace PROD;

OLEDB CONNECT32 TO [Provider=OraOLEDB.Oracle.1;Persist Security Info=False;User ID=wms_dw;Data Source=WMS_DWPROD;Extended Properties=""] (XPassword is PSWD);

ELSEIF '$(ServerEnv)' = 'TEST' then

trace TEST;

OLEDB CONNECT32 TO [Provider=OraOLEDB.Oracle.1;Persist Security Info=False;User ID=wms_dw;Data Source=WMS_DWPROD;Extended Properties=""] (XPassword is PSWD);

end if;