Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone,
I am having the excel source like Sample_03.22.2017AM and Sample_03.22.2017PM which will generated by daily basis.So I am pulling all the excel source by loading like Sample_*. xlsx.
In case any data file cannot be uploaded, an error should be raised and a log page should populate with the date and AM/PM missing data details.
How will achieve this? Can anyone assist me to get this done.
Thanks,
ShakilaD
Thanks for the Update Massimo.
I have included the custom log instead of Trace.Its working fine.
Find the updated Script logic as below:
I think you have to loop on every file and check if the file exists, something like
vStart = Date(Today() - 10); // start date
vNumOfDates = 10; // num of dates
// date loop
FOR i=1 to $(vNumOfDates)
LET vDate = Date('$(vStart)' + $(i) - 1);
//TRACE $(vDate);
// AM PM loop
FOR each ampm in 'AM', 'PM'
LET vFile = 'Sample_' & Date('$(vDate)', 'MM.DD.YYYY') & '$(ampm)';
TRACE $(vFile);
IF FileSize('$(vFile)')>=0 THEN
Log: LOAD 'File $(vFile) exists' as Msg AutoGenerate 1;
ELSE
Log: LOAD 'File $(vFile) does not exist' as Msg AutoGenerate 1;
ENDIF
NEXT
NEXT
Thanks maxgro
But the script execution should terminate when the specific file not found.
Then in the log file should show the specific file not found error message?
Can you help me to do this?
add an exit script, bold
vStart = Date(Today() - 10); // start date
vNumOfDates = 10; // num of dates
// date loop
FOR i=1 to $(vNumOfDates)
LET vDate = Date('$(vStart)' + $(i) - 1);
//TRACE $(vDate);
// AM PM loop
FOR each ampm in 'AM', 'PM'
LET vFile = 'Sample_' & Date('$(vDate)', 'MM.DD.YYYY') & '$(ampm)';
TRACE $(vFile);
IF FileSize('$(vFile)')>=0 THEN
Log: LOAD 'File $(vFile) exists' as Msg AutoGenerate 1;
ELSE
Log: LOAD 'File $(vFile) does not exist' as Msg AutoGenerate 1;
// add a trace if you want
TRACE ..........................;
exit script;
ENDIF
NEXT
NEXT
Thanks for the Update Massimo.
I have included the custom log instead of Trace.Its working fine.
Find the updated Script logic as below: