2 Replies Latest reply: Mar 30, 2015 11:08 AM by Gabor Tarnoczai RSS

    Using variables in load script

    Gabor Tarnoczai

      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

        • Re: Using variables in load script
          Michael Tarallo

          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