Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
MVP
MVP

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)];

Highlighted

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