2 Replies Latest reply: Mar 11, 2016 4:06 PM by Sandro Pividori RSS

    Read existing files

    Sandro Pividori

      Hi.

      I need to read the names of existing files in a specific folder and load them into a table.

      I solve QlikView as follows:

      SET FilePath='*.qvd';

      sub DoDir (Dir)

      for each File in filelist (Dir&'\'&'$(FilePath)')

      SET sFile = $(File);

          NomFile:

           First 1 LOAD

           FileTime() As FileTime,

           FileName() As FileName,

           Left(FileName(),1) as FId,

           left(Right(FileName(),12),8) as FNom

          from [$(sFile)];

         next File

      end sub;

      call DoDir ('C:\Users\Qsense');

       

      But with Qlik Sense not working. Any suggestions?.

      Regards.

        • Re: Read existing files
          Ruben Marin

          Hi Sandro, in Sense you have to create a connection to a folder using the button on the right side of the script panel:

           

          Then you can use this script:

          SET FilePath='*.qvd';

          sub DoDir (Dir)

           

          for each File in filelist ('$(Dir)\$(FilePath)')

          SET sFile = '$(File)';

              NomFile:

               First 1 LOAD

               FileTime() As FileTime,

               FileName() As FileName,

               Left(FileName(),1) as FId,

               left(Right(FileName(),12),8) as FNom

              from [$(sFile)];

             next File

          end sub;

          call DoDir ('lib://YourConecctionName\OptionalMorePath');