2 Replies Latest reply on Jun 6, 2009 12:42 AM by TKnTexas

    Automating file imports



      Automating file imports


      I am writing a little mini app to track the discounts we get per check run per vendor.  Our accounting system spools the print file.  Manually I can import the file to a table.  Every row goes into a field, one record per row of report.  I break that field into out by column on the report to other fields using text calculations (left right middle).  There are obviously lots of dead rows, blank rows, header rows, etc.  I have a find scripted to isolate the rows that actually have discounts taken. I have all the calculations to do things.


      I import to one table to do the parsing and clean up.  Then I import those records into a clean table to accumulate data.  This will let me run reports for months, quarters, with subtotals by vendor.  


      In the scratch table I start by deleting all rows... starting clean.  I prompt for the check date.  I store that in a global.  I can do a calculation in a let statement the creates the file name which is apckrgMMDDYY.ap.   I have set up a path to the folder where the spool files are stored after downloading from the unix box where the accounting is done.  


      When I run the script, it says file not found.  It leaves me in the correct folder that I specified in the PATH.  I can see the file in the folder.  it just doesn't import it.  What am I missing.  Is it because it is a run-time?  I am working in Ver10 Advanced.  I am creating the runtime in Windows.  I really want this to work, it will impress my boss.  *BROWNIE POINTS*


      Any thoughts?

        • 1. Re: Automating file imports

          Does the script run corrrectly if you open the file with FMP advanced instead of the run time? That will answer your question as to whether the runtime is the issue or not.


          You can also open the script in the script editor (using fmp not the run time of course) and double click the Import Records script step to see if you have correctly set up the external data source reference.

          • 2. Re: Automating file imports
               I have mostly solved my problem.  My primary problem with solved with the script step SET VARIABLE. That tied it all together for me.  I still have a little clean up to make it perfect.  This little app has taught me about LET and variables.