Jump to content

Testing for import file existence?


This topic is 6933 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Is there a way to test for the existence of an import file, before actually trying to perform an import? We have a FM DB that is supposed to clear out all previous records, before loading a fresh set from a text file copied to the server from other machines. There's no point in deleting the old records if the new ones are not yet available (for whatever reason); since the old import source files are deleted after every successful import, how can we see if the new ones have arrived, so that we don't prematurely erase the old data?

Link to comment
Share on other sites

  • 3 weeks later...

If on the Mac you can use an AppleScript to do your import, or at least test for it:

tell application "Finder"

set importfile to "Reese_p1:Users:reese:Documents:ProductionSchedule:Saved:JobInfo.fp7"

if file importfile exists then

display dialog "your import command here"

else

--option function here, like email the admin

end if

end tell

Note that I defined the file path as a text string, not as a file. If it were a file then the script would error if the file does not exist.

Reese

Link to comment
Share on other sites

It seems like it would be simple enough to

Set Error Capture [On]

Import Records

If [Get(LastError) <> 100]

Show Omitted Only

Delete All Records

End If

If the file exists (error does not equal 100), then the previously existing records are deleted after the import is performed.

Link to comment
Share on other sites

This topic is 6933 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.