James Steele Posted November 27, 2007 Posted November 27, 2007 I have set up a script to run daily that will import a .csv files that is sent to us by one of our customers (using scriptfire to run them on a schedule). This works great until the customer forgets to post a nightly file. In this case the system sits with an error message until it is manually cleared. How can I have FM check to see if the file exist prior to attempting the import? If it does exsist then it would continue and do the import and if not it would skip this step and continue. Thanks James
MarkWilson Posted November 29, 2007 Posted November 29, 2007 I have not tried it so I will ask, did you try an error capture in the script? To test for a file from the command line with FileMaker use this concept. Send Event[ CMD /C DIR C:ClientFolderClientFile.csv /B >FileTest.txt ] Pause 2 seconds Import the FileTest.txt file into its own table. If the text "ClientFile.csv" imported, the file exists. Continue regular script...
bcooney Posted November 29, 2007 Posted November 29, 2007 Another approach I've used to check to see if a file exists is to use the Import File as reference script step. Then, if that doesn't get an error, continue with the Import Records script. Your path is consistent? How do you know you've gotten the most recent and not yesterday's?
MarkWilson Posted November 29, 2007 Posted November 29, 2007 I like the idea of not leaving FileMaker to check if the file exists alot. To find the date/time information about the file from the command line. CMD /C DIR C:ClientFolderClientFile.csv /T:W /4 >FileTest.txt /T:C = Creation /T:A = Last Access /T:W = Last Written Returns: /? Volume in drive C has no label. Volume Serial Number is AAAA-1111. Directory of C:ClientFolder 11/29/2007 03:42 PM 1 ClientFile.csv 1 File(s) 1 bytes 0 Dir(s) 29,285,822,464 bytes free
James Steele Posted December 4, 2007 Author Posted December 4, 2007 First let me answer the questions so i can provide as much information as posible. Q. did you try an error capture in the script? A. I done any error capture in the script and would not exactlly know how to do that. _________________________________ Q. How do you know you've gotten the most recent and not yesterday's? A. The file that I am importing is dated at the time of export. I have serit up to change the file name to the new name at the import p:vdataimport12032007.csv _________________________________ I have tried the CMD and that seems to work to get the ouutput file, However if the file is not in there the output file is a blank and I get the error "No fileds are defined in the data source" Is there a way to shut that error off? Using the tags /t and such I do not get a blank file but I can not really use the data within. Any sugestions? Thanks for looking at this and any assistance. James
MarkWilson Posted December 5, 2007 Posted December 5, 2007 James, Attached is a set of sample files. Ensure the .csv file names fall within the date range of your testing day and the file path is set for your settings. Once it works for you, try turning the "Set Error Capture" to off. vData.zip
James Steele Posted December 17, 2007 Author Posted December 17, 2007 Mark, I like how that stops the remaining part of the script from running, but I would still need to click the OK button so thst it does not lock the workstation. I am using scriptfire to automate scripts and the problem that I am having is the user intervention that is needed by having to click ok. I would like to get to a point that is logs the activity but does not nees someone to press OK when an error occurs. Thanks Again for all you help. Sorry it took me so long to test it and get back to you. James
Recommended Posts
This topic is 6187 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 accountSign in
Already have an account? Sign in here.
Sign In Now