5 Replies Latest reply on Dec 10, 2010 10:54 AM by philmodjunk

    Displaying records from the same table in corresponding layouts

    ultranix

      Title

      Displaying records from the same table in corresponding layouts

      Post

      Hey, it's my first post here, though I've been using simple FileMaker Pro solutions for a year.

      I need help on such a concept:

      In order not to make it complicated, I've created 4-field database:

      • Name,
      • Last name,
      • ID
      • and Marital Status.

      The "Marital Status" is a drop-down list, which uses 3 different values:

      • empty/no data
      • Single
      • Married

      I also have 3 different layouts: Pool, Single and Married.

      Here's the question:

      How to make a person's record show in the only layout he/she belongs, I  mean - whenever I set a person's status from empty/blank to Single - it only appears in "Single" layout and not in any other layout, whenever I switch person's status from "Single" to "Married", the record appears accordingly in only the "Married" layout.

      I would like to repeat, that here I am using only one table and 3 layouts.

      If I made my point clear, I am waiting for the answer and if something is puzzling, please, let me know, I would enrich my explanation with screenshots.

      married.jpg

        • 1. Re: Displaying records from the same table in corresponding layouts
          philmodjunk

          You can use scripts, script triggers and/or custom menus (FileMaker advanced only) to limit the found set for each layout to only records of the appropriate status. You can also use portals that filter to only list records of a given status.

          Here's a simple script that omits all records that don't have "married" in Marital Status.

          Enter Find Mode[]
          Set Field [YourTable::MaritalStatus ; "Married" ]
          Set Error Capture [on]
          Perform Find[]

          Constrain Found Set

          Script triggers could perform this script with OnLayoutLoad.

          When the View mode changes from Find to Browse, you could use this script:

          Enter Find Mode[]
          Set Field [YourTable::MaritalStatus ; "Married" ]
          Set Error Capture [on]
          Constrain Found Set

          To drop all the non married records from the found set just produced by your find. You can also substitute Get ( ScriptParameter ) for "Married" and use the same script(s) with each layout and pass the desired status as a script parameter when you set up the triggers. That allows you to use the same exact script with all three layouts.

          • 2. Re: Displaying records from the same table in corresponding layouts
            ultranix

            Is there a way to do that without using find mode?

            because it then shows me a "1/3 Found (Unsorted)" on the top and I've seen in filemaker demo files that it's possible to do that without that and without using OnLoadLayout script.

            • 3. Re: Displaying records from the same table in corresponding layouts
              philmodjunk

              I don't see how that's possible without using separate tables for your records--which would probably not be a good design choice for your system.

              You can hide the status area where that 1/3 found info is displayed.

              You can also use portals that filter your records by marital status.

              • 4. Re: Displaying records from the same table in corresponding layouts
                ultranix

                Can you tell me in which way do you see portals working?

                I use portals for a different approach. So if your different approach would fit, I would appreciate.

                Thanks for your answers :)

                • 5. Re: Displaying records from the same table in corresponding layouts
                  philmodjunk

                  I don't think portals are all that great an option here, but then I don't see why the found set display would be a problem either.

                  This method only works in FileMaker 11. If you have an older version, let me know and I'll describe a slightly different but more laborious way to do the same thing.

                  I don't know what other tables you might have in your file so I will assume you have just the one table here.

                  In Manage | Database | Relationships drag from any field from this table to outside the box and back again to set up a new table occurence (called an "instance" in this one dialog box that pops up.) for the same table. Name it AllRecords. Double click the relationship line and change the = to X so that any record in the first table occurrence matches any record in the second.

                  On your layout, create a portal to this new table occurrence. In portal setup, specify a portal filter with this expression:

                  YourTable::Marital Status = "Married" to show only the records where status = "married".

                  Place copies of these two portals on the other two layouts, but edit the filter expression to select for the other two values.

                  You can even define a tab control and place these three portals on separate copies of the same layout if you wish.