3 Replies Latest reply: Jun 9, 2017 3:28 AM by ar eiuiew RSS

    lib: in variable

    Philipp Wesseling

      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

        • Re: lib: in variable

          Try with [] around, for me it works fine

           

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

           

          LOAD

              *

          FROM [$(vPath)table.qvd]

          (qvd);

          • Re: lib: in variable
            Michael Tarallo

            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