Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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:
1 | No error |
2 | General Error |
3 | Syntax Error |
4 | General ODBC Error |
5 | General OLE DB Error |
6 | General XML Error |
7 | General HTML Error |
8 | File Not Found |
9 | Database Not Found |
10 | Table Not Found |
11 | Field Not Found |
12 | File Has Wrong Format |
Hope it helps
I haven't syntax checked your example, but yes, the concept is valid.
-Rob
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
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 ;