Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
Not applicable

Using a Config file for ODBC Connect statment values

I'd like to read in a standard text configs.csv config file to load values for the ODBC Connect Statement.

Example:

config.csv:

conf_value, conf_field
odbc_name,test
user_id,user
password,password

script:

ODBC CONNECT TO confvalue1 (UserId isconfvalue2, Password is confvalue3);

Is this possible? When I try adding variables to the ODBC CONNECT statement I am getting syntax errors.

Thanks

1 Reply
Highlighted
Partner
Partner

Using a Config file for ODBC Connect statment values

Hi PMCanada, yes it is possible!

here is a sample:

_______________________________________________________________________

tmp:

LOAD * INLINE [

    conf_field, conf_value

    ODBCName, YourODBCName

    UserID, YourUserID

    Password, YourPassword

];     //replace this inline load with your load from the csv file

let vODBCName = lookup('conf_value', 'conf_field', 'ODBCName', 'tmp');

let vUserID = lookup('conf_value', 'conf_field', 'UserID', 'tmp');

let vPassword = lookup('conf_value', 'conf_field', 'Password', 'tmp');

drop table tmp;

 

ODBC CONNECT TO $(vODBCName) (UserId is $(vUserID), Password is $(vPassword));

_______________________________________________________________________

Hope this helps you.

Regards,

Fernando