Discussion board where members can get started with QlikView.
I am using for loop to load multiple csv files in my script. I wanted to implement try catch (Error handling) so that if certain csv file fails to load I can track it without stopping my script load.
for i=0 to NoOfRows('Master_FileList') - 1 let vCSVPath=peek('CSVPath',$(i),'Master_FileList'); concatenate(UserNamedCalInfo) load Environment, User_ID, AccessDate from [$(vCSVPath)]; Next I
if ScriptError=8 then (HERE WHAT CONDITION I NEED TO PUT INSTEAD OF 8 . SINCE I AM READING CSV NAME THROUGH VARIABLE)
exit script; (I DONT WANT TO STOP MY SCRIPT EXECUTION)
Where can I look for error, I mean which particular csv file got failed to load.
Appreciate any help on this.
you can do an FOR EACH Loop. This Loop goes over an folder or Datafiles.
FOR EACH File In FileList('Data\xls\*csv')
(ooxml, embedded labels);
Its make it maybe easier.
Than you can check with if(NoofRows('Table1')>0) then
if there are data available.
Hopefully it will help you.
Using your method, if all you want is a list of missing files, then you can store CSVPath as a new field in your table ...
'$(vCSVPath)' as File,
... then compare the loaded values with your Master_FileList table ...
Set ErrorMode = 1; FileLoadErrors: Load CSVPath as MissingFile resident Master_FileList where Not(Exists(File,CSVPath));
Hope this helps
It is very helpful. Its working. Thanks,
Sorry for late reply. I implemented this code today.