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

ErrorMode not working with missing of single quote

Hello experts,

I have a scenario, please refer to my below script.

SET ErrorMode = 0;

Employees:

LOAD * INLINE [

    EmpID, Name, Dept

    4405, James, Sales

    4408, David, Finance

    4412, Bobby, HR

    4420, Chan, Sales

    4438, Mike, Human Resource

    4456, Volker, Sales

];

SET vHRFilter = "Match(Dept,HR','Human Resource')";

HR_User:

LOAD EmpID,

  Name as HRUser

Resident Employees Where $(vHRFilter);

Let vError = Num(ScriptError) &' - '& ScriptErrorDetails;

I have also attached the same qlikview file here for your easy reference.

The actual Match case should be Match(Dept,'HR','Human Resource'); but for testing I purposely skipped the open single quote for HR. By right the SciprtErrorDetails should capture this error, but it is not. Is it a know QlikView issue? Any idea how to over come this kind of scenario? Does it need hot fixes from QlikTech Consultants?

All you valuable suggestions are most welcome.

Thanks in advance.

Shankar

6 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Check this from Qlikview help file

If you give SET ErrorMode = 0; then qlikview simply ignores error, if you want the error message then you need to set it as 1

ErrorMode

This variable determines what action is to be taken by QlikView when an error is encountered during script execution. By default (ErrorMode=1) the script execution will halt and the user will be prompted for action (non-batch mode). By setting ErrorMode =0 QlikView will simply ignore the failure and continue script execution at the next script statement. By setting ErrorMode =2 QlikView will trigger an "Execution of script failed..." error message immediately on failure, without prompting the user for action beforehand.

Regards,

Jagan.

tresesco
MVP
MVP

In the textbox, try like:

=Num(ScriptError)&'-'&ScriptErrorDetails

Not applicable
Author

Hi Jagan,

Thanks for your reply. I don't want QlikView to throw error, I need to handle the error. Am capturing the error text thru ScriptErrorDetails variable. For all other possible errors it is working fine. But when single quote is missing, this ScriptErrorDetails variable is not capturing the error. But when I check the log file, it is marked as error in the last line

Anonymous
Not applicable
Author

Hi,

it doesn't produce an error because set vVariable does not interprete  the string after the statement (there are exceptions like '$').

Your expression:

Let vError = Num(ScriptError) &' - '& ScriptErrorDetails;

won't work as you do not evaluate the variables like num($(ScriptError)) but qlikview tries to ev. your expression due to let.  Also evaluating $(ScriptError) with num does not work as this will return Null-Value if you have text.

Best regards

Stefan

jagan
Luminary Alumni
Luminary Alumni

Hi Gowri Shankar,

Not sure why it is not working, the statements after error is not executing may be somebody from Qlikview side help on this.

Sara Leslie Henric Cronström please help on this.

Regards,

Jagan.

hic
Former Employee
Former Employee

As far as I can see, it works the way it should. A missing single quote means that the parser sees the rest of the script as part of the string that is being quoted. Which means that the last Let statement never is executed, because it is part of the string.

If you run the script in the debugger, this is visible:

Image2.png

Of course you could wish that the parser should be "smart" enough to understand that it should skip up until the next semicolon, but then it wouldn't be possible to have semicolons in quoted strings...

HIC