Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
volkanburc
Contributor
Contributor

For Loop and SubField

Hi.

I would like to draw multiple files in the For loop based on the date value in the file path. What's the problem with my code?

SET CONCATENATE=;
SUB SCANFOLDER(ROOT)
FOR Each EXT in 'xlsx'
LOAD
BİLANÇO AS GT2
FROM [$(FoundFile)](ooxml, embedded labels,table is [Aktif Detay]);
LET vTitle2=FieldValue('GT2',2);
LET vYear=SubField(FieldValue('GT2',2),'.',4);
Let vMonth=SubField(FieldValue('GT2',2),'.',5);
FOR Each FoundFile in FileList(ROOT&'\*'&EXT);
FileList:
$(CONCATENATE)
LOAD *,
$(vMonth)&'.'&$(vYear) AS Yil
FROM
[$(FoundFile)](ooxml, embedded labels, header is 5 lines, table is [Aktif Detay])
WHERE
[Şirket Kodu]<9000 AND IsNull([Şirket Kodu])=0;
SET CONCATENATE = concatenate;
NEXT FoundFile
NEXT EXT

FOR Each SubDirectory in DirList(ROOT&'\*')
CALL ScanFolder(SubDirectory)
NEXT SubDirectory
END SUB

CALL SCANFOLDER('C:\Users\vsatilmis\Desktop\SigortaForLoop')

0 Replies