Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Relative Path on ODCB Connection

Hi,

Currently I have this issue where I need to put an ODBC connection like the following:

ODBC CONNECT32 TO [Excel Files;DBQ=C:\Users\Documents\Proyect\File.xlsx];

I constantly need to change the location of the file so I have to change the absolute path to relative to work. So far relative paths seem not to work with ODBC connections.

Does anybody know any way to make an ODBC connection work with relative path?

Cheers,

2 Replies
petter
Partner - Champion III
Partner - Champion III

I would use a variable and then change the variable and use $-sign expansion:

// - 1 means up one level .... -2 would mean up two levels:

vPath = Left( DocumentPath() , FindOneOf( DocumentPath() , '\' , SubStringCount( DocumentPath() , '\' )  -1 ) );

LEFT vFile = file1.xlsx';

ODBC CONNECT32 TO [Excel Files;DBQ=$(vPath)$(vFile)];

avinashelite

you can push the file path to a text file and you the same in variable so that it will be easy to maintain and update