9 Replies Latest reply on Mar 19, 2009 9:43 AM by raybaudi

    Import Records



      Import Records


      I created a script to import records but am having a slight problem. I have the script set to perform without dialog. Each time I am going to do an import the file names will be different but the source fields and the target fields will be the same. Is there a way for me to specify the source and target fields without specifying the file that should be imported? Any guidance would help.



        • 1. Re: Import Records

          You can set the Specify Import Order to Matching Names since you're sure the fields will match.

          Not sure why you are using Perform Without Dialog option.

          When you do this you are forced to supply the file Path in the Specify data source.


          In Mac OS you could use an applescript step the put up a choose file dialog,  then store the path in a variable and enter the variable as the Specify data source.


          It's a long process so if your really interested post back and I'll include the details.



          • 2. Re: Import Records
               Unfortunately I'm not using a Mac, but would this be possible to do in Windows? I am using the perform without dialog option because the file name is not the same each time. What I pretty much have is an online registration form and once registration is closed for a specific event it is exported to a CSV file, so my file name changes with each event. I am then importing the CSV file into FileMaker Pro.
            • 3. Re: Import Records

              From your explanation it sounds like you would want the dialog box to appear. When it pops up, the user can then specify the file name and do it.


              I assume that you don't want this because...


              You want to run this as a server scheduled script and import records isn't compatible unless you choose "run without dialog".


              Or perhaps you want to dump a whole bunch of these files into a single folder and have the script import all of them into the database?


              • 4. Re: Import Records

                I have chosen "run without dialog" which works because I do want to select the file that I want imported. What my question is, is there a way to specify the source fields even though I have not specified the data source? The source fields will always be the same, and so will the target fields. I need to specify the source fields because the field names are different in the CSV file than they are in the FileMaker Pro database.


                When I do a simple "File --> Import Records --> File... I choose my CSV file and the field names don't match. I tried changing the way "Arrange By" from the Import menu but that did not fix it so in order to get it to import correctly i have to do a custom import order.


                For Example:


                Source Fields            Target Fields

                Id                            Last

                Order Date                First

                Payment Processed    MI


                So in my script that is why I will have to specify the source fields and target fields without specifying the data source because the data source will be different each time. Is this possible? If so, how could I do it. 



                • 5. Re: Import Records

                  Just to say something...


                  What about a double import ?


                  First one from the .csv file to a FileMaker table having the fields with the same names ( import by matching names ).


                  Second one from this table to another table of the SAME .fp7 file.

                  • 6. Re: Import Records

                    If I do use a double import is it possible to execute scripts from one table in a different table?


                    • 7. Re: Import Records

                      What do you mean by "double import" and what does this have to do with running a script? Scripts will attempt to interact with whatever records are part of the found set of the current layout's table. To change the found set, use script steps such as find, sort, omit. To work with a different table, use go to layout to bring up a table that refers to the desired table in its layout set up.


                      What you may not have picked up from our attempts to help you is that you will most likely need to define a relationship that uses one or more pairs of fields to link records in your two fields. What form that relationship will take and whether you need one relationship or many depends on what you want to do with your database.

                      • 8. Re: Import Records

                        I got the idea of a double import from raybaudi's reply. This is what my understanding of the process is and what I am planning on doing:



                        .csv file      --->      FM File 1      --->      FM File 2

                                 Import Script 1          Import Script 2


                        Script 1: "Perform without dialog" script with unspecified data source. Records replace the old ones in FM File 1.

                        Script 2: Specify the data source as FM File 1 and set import order.


                        Now if I create a button in FM File 2 to execute Script 2, could I set up Script 2 to execute Script 1 and then import the records from FM File 1 to FM File 2?

                        • 9. Re: Import Records

                          jorom wrote:



                          .csv file      --->      FM File 1      --->      FM File 2

                                   Import Script 1          Import Script 2


                          Why not a simpler:


                          .csv file      --->      Table 1      --->      Table 2

                                   Import Script 1          Import Script 2