Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

rendiyan
Not applicable

[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
jontydkpi
Not applicable

Re: [ASK] Capture and store Load Error

>>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
8 Replies
tresesco
Not applicable

Re: [ASK] Capture and store Load Error

Try without quotes, like:

LOAD * INLINE [

LEGAL,ErrorScript

'$(vFlag),$(ScriptError)

];

jontydkpi
Not applicable

Re: [ASK] Capture and store Load Error

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
Not applicable

Re: [ASK] Capture and store Load Error

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

thank you anyway

rendiyan
Not applicable

Re: [ASK] Capture and store Load Error

‌where to put purgechar() script?

thank you

tresesco
Not applicable

Re: [ASK] Capture and store Load Error

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

jontydkpi
Not applicable

Re: [ASK] Capture and store Load Error

>>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
Not applicable

Re: [ASK] Capture and store Load Error

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
Not applicable

Re: [ASK] Capture and store Load Error

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