1 Reply Latest reply on Jun 24, 2016 4:27 PM by lindseym

    Import Records Script Reference File in folder of open FMP File


      I am wondering if there is a way to create a script that will import a CSV from the same folder where the FMP file is. The names and locations of the files don’t have a set path. We work primarily on MAC but do have some people  on PC. Here is the typical file path — but it changes.


      Screen Shot 2016-06-24 at 12.01.04 PM.png


      Ideally, it would be able to know to grab the CSV with the same name as the FMP, If underscores do not work well, at this point I can name it anything I want, but would ideally keep the set up as below.










      Alternatively, I wouldn’t want to change protocol, but I could make the csv have a constant file name, but the script would still need to know to reference the folder of the current file.





      Here is as far as I got... can I do calculations in the File Path List?


      Screen Shot 2016-06-24 at 1.39.27 PM.png


      And the error I get:


      Screen Shot 2016-06-24 at 1.41.36 PM.png

        • 1. Re: Import Records Script Reference File in folder of open FMP File

          Well, I feel silly. After much research,FMP knows to start in the containing folder UNLESS you tell it specifically to look elsewhere.


          Import Records

          For FileMaker Pro, if an absolute path is not specified in a script that will be executed from FileMaker Pro, the path is assumed to be relative to the location of the database file from which the script was run. For example, if a script containing the Export Records script step is run with the pathname file:/export.tab, and the file running the script is /MyFiles/Library/Books.fmp12, the exported file will be created as /MyFiles/Library/export.tab.