Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there,
I am trying to load multiple CSV with 2 x IF conditions.
Load only IF
1. the CSV file name DOES NOT contain 'double', 'single', 'jumbo'
AND
2. FileTime() > 18/06/2020 - Meaning load the CSV only if the file modified has a date greater than 18/06/2020
But I am not familiar on how to construct the script.
See my attempt below - The issue is highlighted in red
Set Path = 'C:\TESTING\';
for each File in filelist(Path & '*.csv')
If FileTime() >= Date#('22/06/2020','DD/MM/YYYY') AND
If(NOT(Wildmatch('$(File)', '*double*','*single*', '*jumbo*'))) THEN
Facts:
LOAD
LeadIndicator,
QuoteNo,
Brand
FROM
[$(File)]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
;
End If;
Next File;
Thank you
One solution :
set Path ='./CSV22062020';
FOR each vFile in filelist('$(Path)/*.csv')
let Datecheck=floor(Date(FileTime('$(vFile)')))-floor(Date('18/06/2020'));
let Filechek=wildmatch('$(vFile)','*double*','*single*','*jumbo*');
IF '$(Datecheck)'>=0 and '$(Filechek)'=0 then
Data:
LOAD LeadIndicator,
QuoteNo,
Brand
FROM
[$(vFile)]
(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);
endif
NEXT
One solution :
set Path ='./CSV22062020';
FOR each vFile in filelist('$(Path)/*.csv')
let Datecheck=floor(Date(FileTime('$(vFile)')))-floor(Date('18/06/2020'));
let Filechek=wildmatch('$(vFile)','*double*','*single*','*jumbo*');
IF '$(Datecheck)'>=0 and '$(Filechek)'=0 then
Data:
LOAD LeadIndicator,
QuoteNo,
Brand
FROM
[$(vFile)]
(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);
endif
NEXT