2 Replies Latest reply on Jun 3, 2010 11:19 AM by cMuller

    Export records from body part

    cMuller

      Title

      Export records from body part

      Post

      Hello and thank you in advance for your help.

       

      Using FMP 10 on osx

       

      I am trying to make a button on a body part definition that exports a file for only that record. When I set it up using "Export Records" it exports all of the records in the current found set.

       

      I think the solution is to create a script that constrains the found set and then exports the single record. However, I am having trouble mapping the find to this related record.

       

      Thanks

        • 1. Re: Export records from body part
          philmodjunk

          Does your record contain a field with a unique ID such as an auto-entered serial number? If not, define one and use replace field contents to update your current records with a serial number. Once you've done that, you don't even need to have this field visible on any layout.

           

          Now you can use the current record's serial number in find to isolate this one record:

           

          Assuming serial number field is called "ID"...

           

          Set Variable [$ID ; Value: YourTable::ID ]

          Enter Find mode []

          Set field [YourTable::ID ; $ID ]

          Perform Find[]

           

          If you aren't hosting this database over a network, you can also use this code to isolate the current record:

          Show All Records

          Omit Record

          Show omitted only

           

          I don't suggest this in a multi-user environment, because there's a small chance that another user could create a new record at the same time this script runs and then show omitted only could pull up that new record along with the one your script omitted.

          • 2. Re: Export records from body part
            cMuller

            Phil, you are the man. Many thanks.