Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Setting a Variable in "LOAD" in Scripts

Hello,

My data sources change monthly, and all are excel files with "YY-MM" at the end of the file name, so to make it easier to change those references, I'd like to set two variables, like this:

Set FilePath='C:/Path' //Just an example

Set Ref='AA-MM' //With YY being current year and MM last month, i.e.: 12-11

I'd then use this variables in LOAD field of my sources, like:

[Example]:

LOAD Data1,

     Data2

FROM FilePath&'FileName'&Ref&'.xls' (ooxml, embedded labels, header is 1 lines, table is DATA);

Instead of:

[Example2]:

LOAD Data,
     Data2

FROM
(biff, embedded labels, header is 1 lines, table is DATA);

However, this does not seem to work, as Qlikview searches for the root folder of my .qvw file first instead of going to FilePath. Is there any way to do this?

1 Solution

Accepted Solutions

Re: Setting a Variable in "LOAD" in Scripts

Try:

FROM $(FilePath)&'FileName'&$(Ref)&'.xls'


talk is cheap, supply exceeds demand
2 Replies

Re: Setting a Variable in "LOAD" in Scripts

Try:

FROM $(FilePath)&'FileName'&$(Ref)&'.xls'


talk is cheap, supply exceeds demand
Not applicable

Re: Setting a Variable in "LOAD" in Scripts

It complained about the & and ' ', but it worked:

FROM $(FilePath)FileName$(Ref).xls

Everytime I use a variable, u must use it inside $()?

Community Browser