November 27, 200718 yr 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
November 29, 200718 yr 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...
November 29, 200718 yr 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?
November 29, 200718 yr 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
December 4, 200718 yr Author 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
December 5, 200718 yr 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
December 17, 200718 yr Author 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
Create an account or sign in to comment