Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

undergrinder
Valued Contributor 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
Employee
Employee

Re: Using variables in load script

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

2 Replies
Employee
Employee

Re: Using variables in load script

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

undergrinder
Valued Contributor II

Re: Using variables in load script

Thank you Michael!

It was the right solution.

Gábor