![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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? |
)
#3
| |||
| |||
|
|
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? |
#4
| |||
| |||
|
|
"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 ) |
#5
| |||
| |||
|
|
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 |
#6
| |||
| |||
|
|
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. |
#7
| |||
| |||
|
|
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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |