7 Replies Latest reply on Apr 17, 2009 8:38 AM by philmodjunk

    Generate Layout Only Showing Records Where A Field Is Set to Specific Value

    Peakoverload

      Title

      Generate Layout Only Showing Records Where A Field Is Set to Specific Value

      Post

      I'm a complete novice to FileMaker and have only been using it for a few hours and so far it makes sense but I've hit a wall and can't work around it.

       

      I'm creating a Fault Logging Database where I have one field called Status which is a Value List and only has two options "Closed" and "Open".

       

      I've also created another layout called "Outstanding Faults" which at the moment gives a summary list of all the records but I only want it to show the records in which the Status field is set to "Open".

       

      How do I get the "Outstanding Faults" layout to only show records that are "Open"?

        • 1. Re: Generate Layout Only Showing Records Where A Field Is Set to Specific Value
          philmodjunk
            
          1. Enter find mode.
          2. Select Open from your value list formatted field
          3. Click Find or press the Enter key.

          Your layout will show all the records in your "found set" of records. If you haven't performed a find operation, your found set will consist of all records. By performing a find, you can pull up just the records you want to see for a given report.

           

          That's how to do it by hand. You can also do it in a script and set a button or script trigger to do it automatically.

          • 2. Re: Generate Layout Only Showing Records Where A Field Is Set to Specific Value
            Peakoverload
               Ahh right, cheers Phil I think I follow you. So it's not possible to have it that when you browse to the Outstanding Faults layout it automatically performs the search and displays the results in a list, i.e. you have to do a search first (either manually or via a button) and then go to the Outstanding Faults layout to view the results?
            • 3. Re: Generate Layout Only Showing Records Where A Field Is Set to Specific Value
              philmodjunk
                

              I started with the simple solution. We have to walk before we can run right? :smileywink:

               

              If you are using fmp 10, you can use the OnLayoutLoad event to trigger a script to find just the records you want for your layout. If you are using an older version, you'll need to use a button. I usually use buttons in the top of my layouts to take users from one layout to another anyway, so attaching a button that selects the layout and performs any needed finds and sorts usually does the job for me without resorting to a script trigger.

               

              To set a script trigger for a layout:

               

              Enter layout mode

              Select Layouts | Layout Setup....

              Click the script triggers tab and select both trigger and script you want for your current layout.

              • 4. Re: Generate Layout Only Showing Records Where A Field Is Set to Specific Value
                Peakoverload
                  

                Aha! Yep I'm with you now Phil. That sounds like what I'm after. I am using fmp 10 and am amazed at how easy it is to pick up especially as I've never built a database in my life before! Up until now everything has been very straight forward and thanks to you I think I now know enough to complete the project.

                 

                 

                Hope that's not famous last words 

                • 5. Re: Generate Layout Only Showing Records Where A Field Is Set to Specific Value
                  Peakoverload
                    

                  Okay it was famous last words.

                   

                  I have a table called Fault Tracking which has a number of fields one of which is called Status. I then have two layouts one called Faults which is a form view and another called Outstanding Faults which is a list view.

                   

                  I'm trying to get it that when I go to the Outstanding Faults layout it automatically shows me only Records in which the Status field is set to Open.

                   

                  In an attempt to get this to work I've gone to the Outstanding Faults layout, clicked on Edit Layout and then gone to Layout>Layout Setup and then clicked on the Script Triggers tab and selected OnLayoutLoad.

                   

                  I've then clicked on the Select button and in the Specify Script window I select Find and in the Optional Script Parameter I've entered various things like:

                   

                  Fault Tracking::Status="Open"

                   

                  This causes the Outstanding Faults layout to open in a search mode but it doesnt display any records and in the top right corner it says Script Paused. If I click the Continue button it then says that no criteris was entered and then displays every record.

                   

                  Fault Tracking::Status: [Open]

                   

                  Gives me a message saying that the Specified Field Cannot Be Found even though this is the same formula that I got from a saved search which worked.

                   

                  Umm, what should I be entering here???

                   

                  • 6. Re: Generate Layout Only Showing Records Where A Field Is Set to Specific Value
                    Peakoverload
                      

                    Aha! Solved it.

                     

                    Not quite sure what I've done differently but I ended up creating a new script and then setting that to run when the layout loaded.

                    • 7. Re: Generate Layout Only Showing Records Where A Field Is Set to Specific Value
                      philmodjunk
                        

                      In an attempt to get this to work I've gone to the Outstanding Faults layout, clicked on Edit Layout and then gone to Layout>Layout Setup and then clicked on the Script Triggers tab and selected OnLayoutLoad.

                       

                      I've then clicked on the Select button and in the Specify Script window I select Find and in the Optional Script Parameter I've entered various things like:

                       

                      Fault Tracking::Status="Open"

                       

                      Don't use the script parameter, it won't do what you want in this case.

                       

                      In your script, you should have a script step that says

                       

                      Perform Find [restore]

                       

                      Add this step and click the specify button.

                      Click New

                      Select the Fault Tracking table from the drop down table

                      Type "Open" (with out the quotes) in the Criteria box and click "Add"

                       

                      Save your script and now it should work.

                       

                      The Script Parameter option is a trick for sending information to a script that you want to perform. THe script has to extract that parameter with a Get(Script Parameter) function that is included in one script step  or another. We don't need that for this case.