2 Replies Latest reply on Oct 24, 2011 8:59 AM by LeeRoy

    Storing the filename when importing csv data



      Storing the filename when importing csv data


       Hi all,

      I am new to FileMaker and currently working through the VTC tutorials. I am retraining in FileMaker and currently work on a Telcommunications Billing Engine. One of my clients who I work for on there Billing System are using Access Database for some financial reporting which the Billing Engine provides. I have suggested using FileMaker as they are hitting problems in using Access (mainly the size limitations).

      To this end, I have been asked to put together a demonstration of importing data in various csv files and storing them into tables. This is faily straight forward, however they would like to have the filename of the CSV file stored in the table as well and I can not seem to work out A/ if this is possible and B/ How I would achieve it.

      I am currently using a script attached to a button that imports the daily data into the table. Idealy I would like the filename to go into a seperate table and a file id generated and stamped against each record that the data in the csv file creates. Therefore I would need to know the filename before the import, so I looked at using a Custom Dialog, however you can only except a text/string input, it would be nice to have a system file browse dialog. I am writing this on a Mac, however if they want a solution in FileMaker, it will be deployed on Windows.

      If anyone out there could help point me in the right direction, I would be very greatful.



        • 1. Re: Storing the filename when importing csv data

          To capture the filename of your file you can use the following technique:

          Define a container field (can be global)

          Use Insert File with the "store a reference" option to insert a reference of your import file into this field.

          You can now use a calculation to extract the filepath of the file to store in a variable you can use with the import records step to import the csv data. Since you have the filepath in a variable, you can then use text functions to extract the filename from this variable to store in your database.

          Set up right, the user get's an open file dialog to use to select the csv file for importing. When the user selects the file and clicks open, the data is imported and the filename is also captured and stored into the location you specify in your script.

          Here's the text function for extracting the filepath from a container field where "store a reference" was used to insert the file:

          GetValue ( containerField ; 2 )

          • 2. Re: Storing the filename when importing csv data

            Thank you, I will give that a go.. :-)