Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

ErrorMode

Dear All,

I have a doubt here:

If a set the error mode to 0 and then whant to create a msgbox if an certain script error happens how can i do it?

Code:

set errormode=0;

Load * from xx;

if ScriptError=8 then

Load

MsgBox('aa', 'aaa', 2, 48,512) as X

AutoGenerate 1;

//no file;

Does anyone know if thats valid?

Thanks,

Eliano

4 Replies
MayilVahanan

Hi

     What error ?

    

set errormode=0;

Load * from xx;

if ScriptError=8 then

Load

MsgBox('Message 2', 'msgbox', 'OKCANCEL', 'ICONASTERISK') as x, 2 as r

autogenerate 1;

end if

Details:

1No error
2General Error
3Syntax Error
4General ODBC Error
5General OLE DB Error
6General XML Error
7General HTML Error
8File Not Found
9Database Not Found
10Table Not Found
11Field Not Found
12File Has Wrong Format

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I haven't syntax checked your example, but yes, the concept is valid.

-Rob

fosuzuki
Partner - Specialist III
Partner - Specialist III

Hi,

you don't need a load statement to trigger the msgbox function. You can directly use it like this:

set errormode=0;

Load * from xx;

if ScriptError=8 then

let x = msgbox('file not found', 'caption');

end if

Another suggestion is to test if the file exists before loading it:

if isnull(FileSize('c:\folder\x.txt')) then

     let x = msgbox('file not found', 'caption');

else

     Load * from c:\folder\x.txt;

end if

Not applicable
Author

Hi,

I want to ask you, is it possible to create a msgbox in your script with text: 'the missing field':

I mean that:

SET ErrorMode = 0;

Load * from XX;

If ScriptError = 11 then

let x = msgbox ('Field not found' , 'Name of the missing field')

End If ;