Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

shansundar
Contributor

Not able to filter Sub routine result set

Hi Qlikers,

I'm having an issue in extracting the particular txt file from the task log folder. So, I got the below sub routine from community and modified accordingly to do my task as below,

sub ScanFolder(Root)

  for each FileExtension in 'txt'

  for each FoundFile in filelist( Root & '\*.' & FileExtension)

  FileList:

  LOAD '$(FoundFile)' as SourceFile,

  FileTime( '$(FoundFile)' ) as Filetime

  AUTOGENERATE 1;

  Set vConcatenate = Concatenate;

  next FoundFile

  next FileExtension

  for each SubDirectory in dirlist( Root & '\*' )

  call ScanFolder(SubDirectory)

  next SubDirectory

end sub;

Step 1 : Call the sub routine to extract all the txt files from the root folder (including sub folders).

Call ScanFolder ('myfolder\Log');

Step 2 : Do a resident load from the sub routine result set table and then filter the data based on the task name.

FinalFileList:

LOAD

SourceFile,

Filetime

RESIDENT FileList

WHERE SourceFile LIKE '*Reload_Task_Check';

But after this step 2 I'm not getting the desired result. Only the FileList table is there, but not the FinalFileList table is generated.

Can you please help me here.

Thanks,

Shan S

1 Solution

Accepted Solutions
MVP
MVP

Re: Not able to filter Sub routine result set

It seems to me the FinalFileList has the same number and names of fields of the FileList table

Qlik will concatenate Final.... to FileList

add a noconcatenate

FinalFileList:

NOCONCATENATE

LOAD

SourceFile,

Filetime

RESIDENT FileList

WHERE SourceFile LIKE '*Reload_Task_Check';

2 Replies
MVP
MVP

Re: Not able to filter Sub routine result set

It seems to me the FinalFileList has the same number and names of fields of the FileList table

Qlik will concatenate Final.... to FileList

add a noconcatenate

FinalFileList:

NOCONCATENATE

LOAD

SourceFile,

Filetime

RESIDENT FileList

WHERE SourceFile LIKE '*Reload_Task_Check';

shansundar
Contributor

Re: Not able to filter Sub routine result set

Thanks it works fine