Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
spividori
Specialist
Specialist

Read existing files

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.

1 Solution

Accepted Solutions
rubenmarin

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');

View solution in original post

2 Replies
rubenmarin

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');

spividori
Specialist
Specialist
Author

Hola Rubén.

Funcionó perfecto, gracias.

Saludos.

Sandro.