Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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

Re: ErrorMode

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

Re: ErrorMode

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

-Rob

fosuzuki
Valued Contributor II

Re: ErrorMode

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

Re: ErrorMode

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 ;

Community Browser