dbTalk Databases Forums  

error capture

comp.databases.filemaker comp.databases.filemaker


Discuss error capture in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ursus
 
Posts: n/a

Default error capture - 10-09-2010 , 11:55 AM






FMP 11a winXP

one field MyField < container >
I have written a script wit the following steps

Set error capture [on]
Insert File < MyField ; "filewinLMyFile" >


When the file exists all goes well
When the file doesn't exist I expected the Error Capture to cick in. So I
would be able to present the user with a dialog.
Not so. FMP presents me with a Insert File dialog, this way the user could
select any file he/she wants.

Is there a way to get what I want?

--
Keep well / Hou je goed

Ursus

Reply With Quote
  #2  
Old   
Your Name
 
Posts: n/a

Default Re: error capture - 10-09-2010 , 03:41 PM






"Ursus" <ursus.kirk (AT) ziggo (DOT) nl> wrote

Quote:
FMP 11a winXP

one field MyField < container
I have written a script wit the following steps

Set error capture [on]
Insert File < MyField ; "filewinLMyFile"

When the file exists all goes well
When the file doesn't exist I expected the Error Capture to cick in. So I
would be able to present the user with a dialog.
Not so. FMP presents me with a Insert File dialog, this way the user could
select any file he/she wants.

Is there a way to get what I want?
I'm not certain, but you may need to turn on the No Dialog option for the
Insert command. You then also need Script commands to test for any error.
Something along the lines of ...

Set error capture [on]
Insert File [MyField; "filewinLMyFile"; No dialog]
If [Get(CurrentError) <> 0]
{Script commands for when there is an error}
Else
{Script commands for when there is NO error}
End If

You could test for specific error codes and display more specific error
messages, but you'd need to find out what the various codes are and mean.

Helpful Harry )

Reply With Quote
  #3  
Old   
cortical
 
Posts: n/a

Default Re: error capture - 10-09-2010 , 04:39 PM



On 10/10/10 3:25 AM, Ursus wrote:
Quote:
FMP 11a winXP

one field MyField< container
I have written a script wit the following steps

Set error capture [on]
Insert File< MyField ; "filewinLMyFile"


When the file exists all goes well
When the file doesn't exist I expected the Error Capture to cick in. So I
would be able to present the user with a dialog.
Not so. FMP presents me with a Insert File dialog, this way the user could
select any file he/she wants.

Is there a way to get what I want?


Hi Ursus


I last used this approach:

a utility import table and bts layout
import the file(s) in the specified directory
If the record count = 0 or the specified file name does not exist...

Import allows perform without dialogue, which is the key here to
massaging the feedback messages you want


Once the file has been imported, it can be transferred, or delete all
and do teh normal insert

not what one would call elegant, but achieves the result.


An alternate would be to shell script/vba a directory content list and
filter for the file match; which I would do the next time I need to
implement this.



Chris

Reply With Quote
  #4  
Old   
Ursus
 
Posts: n/a

Default Re: error capture - 10-10-2010 , 04:28 AM



"Your Name" <your.name (AT) isp (DOT) com> schreef in bericht
news:i8qjts$3jc$1 (AT) lust (DOT) ihug.co.nz...
Quote:
"Ursus" <ursus.kirk (AT) ziggo (DOT) nl> wrote in message
news:b96df$4cb09e75$5353989e$14515 (AT) cache1 (DOT) tilbu1.nb.home.nl...
FMP 11a winXP

one field MyField < container
I have written a script wit the following steps

Set error capture [on]
Insert File < MyField ; "filewinLMyFile"

When the file exists all goes well
When the file doesn't exist I expected the Error Capture to cick in. So I
would be able to present the user with a dialog.
Not so. FMP presents me with a Insert File dialog, this way the user
could
select any file he/she wants.

Is there a way to get what I want?

I'm not certain, but you may need to turn on the No Dialog option for the
Insert command. You then also need Script commands to test for any error.
Something along the lines of ...

Set error capture [on]
Insert File [MyField; "filewinLMyFile"; No dialog]
If [Get(CurrentError) <> 0]
{Script commands for when there is an error}
Else
{Script commands for when there is NO error}
End If

You could test for specific error codes and display more specific error
messages, but you'd need to find out what the various codes are and mean.

Helpful Harry )

Thanks Harry,

The Insert command does not have a 'No Dialog' option
When the file doesn't exist it just opens a dialog. Way before any error
capture with Get(CurrentError) could take place.
Actually my script is almost what you have written.
I did expect by turning the error capture on the script would get past any
error occurring.
Not so. Still looking for an answer.

Ursus

Reply With Quote
  #5  
Old   
Ursus
 
Posts: n/a

Default Re: error capture - 10-10-2010 , 04:33 AM



"cortical" <cb (AT) corticaldata (DOT) com.au> schreef in bericht
news:i8qnf6$61q$1 (AT) speranza (DOT) aioe.org...
Quote:
On 10/10/10 3:25 AM, Ursus wrote:
FMP 11a winXP

one field MyField< container
I have written a script wit the following steps

Set error capture [on]
Insert File< MyField ; "filewinLMyFile"


When the file exists all goes well
When the file doesn't exist I expected the Error Capture to cick in. So I
would be able to present the user with a dialog.
Not so. FMP presents me with a Insert File dialog, this way the user
could
select any file he/she wants.

Is there a way to get what I want?



Hi Ursus


I last used this approach:

a utility import table and bts layout
import the file(s) in the specified directory
If the record count = 0 or the specified file name does not exist...

Import allows perform without dialogue, which is the key here to massaging
the feedback messages you want


Once the file has been imported, it can be transferred, or delete all and
do teh normal insert

not what one would call elegant, but achieves the result.


An alternate would be to shell script/vba a directory content list and
filter for the file match; which I would do the next time I need to
implement this.



Chris
Thanks Chris.

I do NOT want to import the contents of a file. I want to insert the
complete file into a container.
There is a big difference between inserting and importing.
Therefore using a utility table would not solve the problem.
A shell-script might perhaps be of some use, but I have very limited
experience with this.
I'll have a look into it.

Ursus

Reply With Quote
  #6  
Old   
Howard Schlossberg
 
Posts: n/a

Default Re: error capture - 10-10-2010 , 01:10 PM



On 10/10/2010 2:33 AM, Ursus wrote:

Quote:
I do NOT want to import the contents of a file. I want to insert the
complete file into a container.
There is a big difference between inserting and importing.

Yes, there is a big difference. However -- you can attempt to import
the file's contents into the global container field. If that works,
then perform the insert; otherwise pop up your own message. An example:

Set Error Capture [ On ]
Set Variable [ $filename; Value:"file:mytestfile.txt" ]
If [ Get(FoundCount) = 0 ]
#must give it at least one record to import into
Show All Records
Omit Record
Show Omitted Records Only
End If
Import Records [ Source: “$filename”; Target: “testTable”;
Method: Update existing; Character Set: “Windows ANSI”;
Field Mapping: Source field 1 import to testTable::container ]
[ No dialog ]
If [ Get(LastError) = 0 ]
Insert File [ testTable::container; “$filename” ]
End If

Reply With Quote
  #7  
Old   
Ursus
 
Posts: n/a

Default Re: error capture - 10-11-2010 , 03:12 AM



"Howard Schlossberg" <howard (AT) nospam (DOT) fmprosolutions.com> schreef in bericht
news:i8svie$79a$5 (AT) news (DOT) motzarella.org...
Quote:
On 10/10/2010 2:33 AM, Ursus wrote:

I do NOT want to import the contents of a file. I want to insert the
complete file into a container.
There is a big difference between inserting and importing.


Yes, there is a big difference. However -- you can attempt to import the
file's contents into the global container field. If that works, then
perform the insert; otherwise pop up your own message. An example:

Set Error Capture [ On ]
Set Variable [ $filename; Value:"file:mytestfile.txt" ]
If [ Get(FoundCount) = 0 ]
#must give it at least one record to import into
Show All Records
Omit Record
Show Omitted Records Only
End If
Import Records [ Source: “$filename”; Target: “testTable”;
Method: Update existing; Character Set: “Windows ANSI”;
Field Mapping: Source field 1 import to testTable::container ]
[ No dialog ]
If [ Get(LastError) = 0 ]
Insert File [ testTable::container; “$filename” ]
End If
Howard,

This is what i now have done. I have created a dummy table with one field.


Set Error Capture [ On ]
Freeze Window
Go to Layout [ “Dummy” (Dummy) ]
Import Records [ Source: “filewin:/C:/test/MyFile.xml”; Target: “Dummy”;
Method: Add; Character Set: “Windows ANSI”; Field Mapping: Source field 1
import to Dummy::import ]
[ No dialog ]
If [ Get ( LastError ) <> 0 ]
Go to Layout [ “input” (Main) ]
Show Custom Dialog [ Title: "ERROR"; Message: "XML missing! Script will
abort."; Buttons: “OK” ]
Exit Script [ ]
End If
Delete All Records
[ No dialog ]
Go to Layout [ “input” (Main) ]
Insert File [ Main::XML; “filewin:/C:/test/MyFile.ml” ]
Set Variable [ $error; Value:Get(LastError) ]
Send Event [ open document/application; "cmd /c del
\"c:\test\MyFile.xml\"" ]
Go to Field [ ]

--
Keep well / Hou je goed

Ursus

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.