Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rendiyan
Partner - Creator
Partner - Creator

[ASK] Capture and store Load Error

Dear Qlik Master,

I have a req to store load error into a table (can be txt / qvd).

I've tried solution from : ErrorHandling in Qlikview

But it won't work.

My script is like below :

Capture and Store Load Error

LOAD * INLINE [

LEGAL,ErrorScript

'$(vFlag)','$(ScriptError)'

];

And it doesn't work.

I've tried to create variable :

Let vScriptError= ScriptError;

And change mw script to below :

New Capture and Store Load Error

LOAD * INLINE [

LEGAL,ErrorScript

'$(vFlag)','$(vScriptError)'

];

But still no error captured.

Is there any solution for this?

Many thank you,

Best Regards,

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

>>where to put purgechar() script?

You may not need this:

LOAD '$(vFlag)' as LEGAL,

  PurgeChar('$(vScriptError)', chr(39)&';') as ErrorScript

AutoGenerate 1;

The second parameter should contain all the characters to strip. If you TRACE vScriptError, you will be able to see if there is anything to strip.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

8 Replies
tresesco
MVP
MVP

Try without quotes, like:

LOAD * INLINE [

LEGAL,ErrorScript

'$(vFlag),$(ScriptError)

];

jonathandienst
Partner - Champion III
Partner - Champion III

ScriptError must be in the line immediately after the error causing line, and it may contain punctuation, so you may need a PurgeChar() to allow for saving in a load. Also use Autogenerate rather than inline

LOAD '$(vFlag)' as LEGAL,

  '$(vScriptError)' as ErrorScript

AutoGenerate 1;

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
rendiyan
Partner - Creator
Partner - Creator
Author

‌i've tries that and doesn't work.

thank you anyway

rendiyan
Partner - Creator
Partner - Creator
Author

‌where to put purgechar() script?

thank you

tresesco
MVP
MVP

See a working script

set ErrorMode=0;

Load * from abc.csv;  // this file doesn't exists

load * Inline [

    Error

    $(ScriptError)

]

You would get  'File Not Found'  as field value.

Capture.PNG

jonathandienst
Partner - Champion III
Partner - Champion III

>>where to put purgechar() script?

You may not need this:

LOAD '$(vFlag)' as LEGAL,

  PurgeChar('$(vScriptError)', chr(39)&';') as ErrorScript

AutoGenerate 1;

The second parameter should contain all the characters to strip. If you TRACE vScriptError, you will be able to see if there is anything to strip.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
rendiyan
Partner - Creator
Partner - Creator
Author

your solution does worked, but it has no complete error detail.

i've combined with jonathan solution and it works.

THank you a lot

rendiyan
Partner - Creator
Partner - Creator
Author

thank you for your solution, it gave me clue to create the script.

and it worked.

my current script is :

LOAD '$(vFlag)' as Legal,

  '$(ScriptError)' as Error,

  '$(ScriptErrorDetails)' as ErrorDetail,

  today() as ErrorDate 

AutoGenerate 1;

thank you a lot