6 Replies Latest reply on Jul 11, 2016 12:45 PM by mikebeargie

    Find related records in other tables

    kschjei

      I would like to have a script that finds related records that are in other tables.

      Example: My Parent table has a record #1000

      My table I have named Exits has 5 records #1000

       

      I would like to have a script that auto finds these so I can import them with my Parent record.

       

      I guess what I am looking for is a way to import 1 record and all of its tables into a separate database when needed.

      Can anyone help??

      Thanks much!

        • 1. Re: Find related records in other tables
          mikebeargie

          FileMaker Pro 15 Help - Go To Related Record. This script step will take you from the parent table to any of the related child tables, showing only the records related to the parent.

           

          So it would be:

           

          Go To Layout [ parent ]

          Export Record [ parent file ]

          Go To Related Record [ child ]

          Export Records [ child file ]

           

          However when you export from a RDBMS like filemaker to a flat data file like XLSX or CSV, you will be doing so with a separate file for each table.

           

          Alternatively, you could create a filemaker file with just the tables that you need, set up the main filemaker file as a data source, and import the records you need to the separate filemaker file.

          • 2. Re: Find related records in other tables
            kschjei

            Mike-

            Life changing :-)

            Thanks so much!

            • 3. Re: Find related records in other tables
              kschjei

              As a follow up.

              I am trying to import these records from 1 database to another (exact) database. Both on the server.

              How would I set up the script so I can get this from one to the other?

              • 4. Re: Find related records in other tables
                mikebeargie

                First you would need to setup the first file as a data source in the destination file.

                 

                Then in the destination file you would write a script with import records, selecting the data source as your source, and a local table in the destination file as the destination.

                 

                You could then perform that script in the destination file anytime it was needed.

                 

                Don’t forget to have a matching privilege set and account/password in both files, as well as to check that the destination file has access to the source file.

                • 5. Re: Find related records in other tables
                  kschjei

                  This works well for my parent file but when I try to import the related records from other tables it downloads all the records from the table. Could you please give me an example of the script I would put in my destination file? Thanks

                  • 6. Re: Find related records in other tables
                    mikebeargie

                    So establish the same relationship using the data sources from your parent file in your destination file.

                     

                    Then in your destination file script, do the same “Go To Related Records” logic on those data sources.

                     

                    EG:

                    Go To Layout

                    Find Records

                    Go To Layout

                    Import Records

                    Go To Layout

                    Go To Related Records

                    Go To Layout

                    Import Records

                     

                    The key is that if you do found sets for those records on layouts in the destination file, then when you go to import from that data source table, it will only import the found set.