4 Replies Latest reply on Dec 20, 2010 4:10 PM by dscott23

    Button to display a specific record?

    dscott23

      Title

      Button to display a specific record?

      Post

      Howdy.  I'm new to FMP so please bare with me.  I have what I think is a simple problem.

      Simply...I have created a database with a single table.  The records in that table contain 3 fields

      Number

      Description

      Price

      I'd like to put a button on a layout that when pressed displays a specific record.  The button would be labeled 100 and when pressed, it would take me to a layout designed to show records from that table and it would show me the specific record that matches 100 in the number field.

      I've tried SET SCRIPT TRIGGERS...ON OBJECT ENTER....then tried to put in a script ... FMP Test Databse table1::number 1 = 100

      But that does not work

        • 1. Re: Button to display a specific record?
          philmodjunk

          Go To Layout [//select your layout here]
          Enter Find Mode [] //clear the pause checkbox
          Set Field [YourTable::Number ; 100]
          Perform Find []

          This seems to be a very inflexible approach for finding a specific record. If you were to describe in more detail what you are trying to do here, we might be able to suggest an approach that lets you find and view any number of specific records--not just record number 100.

          • 2. Re: Button to display a specific record?
            dscott23

            OK..here is more detail of what I'm trying to accomplish.

            I have a table that holds Project details within each record.  Each Project has a specific number (there are around 30 Projects.)  I'm trying to set up a layout that shows each project represented by a button on the layout.  I want to press a button and I want to be taken to a detailed layout of that project..a layout that shows all of the information in the record and the layout will also hold links to every document that is associated with that project..be it a Statement of work (.doc) or a .PPT presentation.

            Clear as mud?

            908-444-8610

            • 3. Re: Button to display a specific record?
              philmodjunk

              I thought that might be what you needed, but wanted to be sure.

              This is easy to set up, but the details depend on how you've set up your list of Projects where you have this button to bring up the details.

              If you have a List view of project titles in a layout based on the same table as your detail records, you can simply place a button in the layout body (so it appears next to each title), that simply uses Go To Layout to switch to a detail (typically form view) layout for the same record.

              If you have two tables:  Projects::ProjectID = ProjectDetails::ProjectID and your list of projects is based on the Projects table, use this script:

              Set Variable [$ProjectID ; Value: Projects::ProjectID ]
              Go To Layout [Project Details ( ProjectDetails ) ]
              Enter FInd Mode [] // clear the pause check box
              Set Field [ProjectDetails::ProjectID ; $ProjectID ]
              Set Error Capture [on] // keep "records not found" dialog from interrupting script if no records are found
              Perform Find []

              Note that this last option can find multiple detail records for the same project should you have a one to many projects to details relationship.

              • 4. Re: Button to display a specific record?
                dscott23

                Here is a link to a short youtube video that might help.

                This problem involves a single table.

                http://www.youtube.com/watch?v=5BreCfOu5EI