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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

lib: in variable

hi there,

can i store a connection string in a variable and then use in different load statements just the variable as a path ?

something like this ?:

let vPath='lib://LIBStandardData/';

LOAD

    *

FROM $(vPath)table.qvd

(qvd);

doesnt work. results in:

Cannot open file 'lib://LIBStandardData/table.qvd'

whereas the usage of the connection explicitely in the FROM clause does work...

any ideas ?

thanks,

philipp

1 Solution

Accepted Solutions
Not applicable
Author

Try with [] around, for me it works fine

let vPath='lib://LIBStandardData/';

LOAD

    *

FROM [$(vPath)table.qvd]

(qvd);

View solution in original post

3 Replies
Not applicable
Author

Try with [] around, for me it works fine

let vPath='lib://LIBStandardData/';

LOAD

    *

FROM [$(vPath)table.qvd]

(qvd);

Michael_Tarallo
Employee
Employee

Hi Philipp - I was working on this exact scenario recently - try this - it works for me. It will give you example of the correct syntax to use when using variables - you need to wrap the variable in single quotes or brackets.

This will also give an idea on how to concatenate variables - for example the path and file name.

let vRootPath = 'lib://QlikSenseDataFolder/';

let vFileName = 'sample_data.qvd';

let vFullFilePath = '$(vRootPath)$(vFileName)';

trace This is the root path: $(vRootPath);

trace This is the file name: $(vFileName);

SampleTable:

Load * Inline [

id,department,budget,actual

1,Sales,200000, 250000

2,Human Resources,150000, 10000

3,Finance,300000,250000

4,IT,245000,100000

];

Store SampleTable INTO '$(vFullFilePath)' (qvd);

Please mark the appropriate replies as helpful / correct so our team and other members know that your question(s) has been answered to your satisfaction.

Regards,

Mike T

Regards,
Mike Tarallo
Qlik
arixooo123
Creator III
Creator III

Hi Daniel,

What if the name of the file is the variable?

Can we use :

Load * from [lib://link/folder/fileName_$(variable).qvd](qvd) ?

I am actually trying load data dynamically, but it doesn't work the way I want to