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

Using variables in load script

Hi all!

I have an issue with a data load script in Qlik Sense 1.1, when I inserted a variable into FROM clause.

Example:

Works well in normal:

LOAD

   Column1,

   Column2

FROM [lib://example\example.xlsx]

(ooxml, embedded labels, table is Sheet1);

Works well with path variable:

LET vExamplePath = 'lib://example\';

LOAD

   Column1,

   Column2

FROM $(vExamplePath)example.xlsx

(ooxml, embedded labels, table is Sheet1);

But does not work with fullpath variable:

LET vExamplePath = 'lib://example\example.xlsx';

LOAD

   Column1,

   Column2

FROM $(vExamplePath)

(ooxml, embedded labels, table is Sheet1);

Any suggestion?

Thank You!

Undergrinder

1 Solution

Accepted Solutions
Michael_Tarallo
Employee
Employee

Hi Gabor

Try this: - surround in [ ] as in:

Set vPth = 'lib://data/Excel_Report_1.xlsx';

TempInit:

CrossTable (Item,Sales,7)

LOAD

  

    'North America' as Continent,

    'United Sates' as Country,

    'Southern' as Region,

    State,

    OrderDate,

    Year(OrderDate) as Year,

    Month(OrderDate) as Month,

    Apples,

    Bananas,

    Oranges

FROM [$(vPth)]

(ooxml, embedded labels, header is 4 lines, table is Southern)

Where State <> 'Total';

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

Regards,

Mike Tarallo

Qlik

Regards,
Mike Tarallo
Qlik

View solution in original post

2 Replies
Michael_Tarallo
Employee
Employee

Hi Gabor

Try this: - surround in [ ] as in:

Set vPth = 'lib://data/Excel_Report_1.xlsx';

TempInit:

CrossTable (Item,Sales,7)

LOAD

  

    'North America' as Continent,

    'United Sates' as Country,

    'Southern' as Region,

    State,

    OrderDate,

    Year(OrderDate) as Year,

    Month(OrderDate) as Month,

    Apples,

    Bananas,

    Oranges

FROM [$(vPth)]

(ooxml, embedded labels, header is 4 lines, table is Southern)

Where State <> 'Total';

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

Regards,

Mike Tarallo

Qlik

Regards,
Mike Tarallo
Qlik
undergrinder
Specialist II
Specialist II
Author

Thank you Michael!

It was the right solution.

Gábor