Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
pjn123pjn123
Contributor III
Contributor III

Error Handling - Add Error Type to a table

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!

1 Solution

Accepted Solutions
pjn123pjn123
Contributor III
Contributor III
Author

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.

View solution in original post

4 Replies
pjn123pjn123
Contributor III
Contributor III
Author

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.

avinashelite

Got your problem but we don't have efficient way to record this

check this once

Error handling in script

pjn123pjn123
Contributor III
Contributor III
Author

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.