Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a script that loads a large quantity of Excel files and I'm trying to the create a table with all the errors (if any) that was encountered during the script load.
//Create Error Handling List
Set ErrorMode=0;
Set ScriptErrorListed=0;
ErrorList:
LOAD * INLINE [
Filename, ErrorType
];
/*
REST OF SCRIPT HERE
*/
//ERROR HANDLING START
IF ScriptErrorCount > ScriptErrorListed THEN
CONCATENATE (ErrorList)
LOAD * INLINE [
Filename, ErrorType
$(File), $(ScriptError)
];
ScriptErrorListed = ScriptErrorCount;
ENDIF
//ERROR HANDLING END
With the code about the ErrorList table is being created and I see the filenames of the files with errors but I cant see the error types (e.g. "Field not found").
Hopefully I'm missing something small
Thanks!
Got the error list to work:
//ERROR HANDLING START //////////////////////////////////////////////
LET ErrorTemp123 = replace(replace(ScriptErrorList,chr(10),' | '),chr(13),'');
ScriptErrorList='';
IF ScriptErrorCount > ScriptErrorListed THEN
CONCATENATE (ErrorList)
LOAD * INLINE [
Filename, ErrorType
$(File), $(ErrorTemp123)
];
ScriptErrorListed = ScriptErrorCount;
ENDIF
//ERROR HANDLING END ///////////////////////////////////////////////
So this gives me a nice table with all the files + error message/type of the errors that was found during the load.
This is very useful if you are loading all the xls files in a folder and you need to know if there where any errors.
Hi Avinash
Thanks for the reply
I did read those files before hand.
My problem is not the way error handling works - My problem is how can I add the last error to an inline table.
Got your problem but we don't have efficient way to record this
check this once
Got the error list to work:
//ERROR HANDLING START //////////////////////////////////////////////
LET ErrorTemp123 = replace(replace(ScriptErrorList,chr(10),' | '),chr(13),'');
ScriptErrorList='';
IF ScriptErrorCount > ScriptErrorListed THEN
CONCATENATE (ErrorList)
LOAD * INLINE [
Filename, ErrorType
$(File), $(ErrorTemp123)
];
ScriptErrorListed = ScriptErrorCount;
ENDIF
//ERROR HANDLING END ///////////////////////////////////////////////
So this gives me a nice table with all the files + error message/type of the errors that was found during the load.
This is very useful if you are loading all the xls files in a folder and you need to know if there where any errors.