2 Replies Latest reply on Dec 2, 2013 10:08 AM by BenjaminDestrempes

    Pop-up menu portal filtering and multiple related records



      Pop-up menu portal filtering and multiple related records



           I am using File Maker Pro Advanced 12 on Windows 7.

           I have a database containing a series of Accounts to which are assigned Contracts. Each Account can have multiple Contracts, and each Contract can have multiple Order #s.

           The DB is set up as follows:

           Accounts::ID = Contracts::fk_Account_ID

           Orders::fk_Contract_ID = Contracts::ID

           I have a portal on the Accounts layout that allows me to create contracts related to that account. What I can't get to work, however, is displaying a second portal that could be filtered via a pop-up menu to display orders related to a specific contract. In other words, I would like to select one of the contracts related to that account and display all related orders, as well as add and remove those related orders.

           Is this possible? Is there a better way to do this?

           Thanks for your time.

        • 1. Re: Pop-up menu portal filtering and multiple related records

               There are two different approaches that can be set up to work. You can set up a portal filter to filter the records and click a button to perform a script in order add new records to your portal that meet the filter criteria.

               You can add another table occurrence of Orders and link it to an additional field in accounts and make your portal a portal to this new occurrence of accounts. With this approach, you can enable the "allow creation..." option and add new records directly in the portal.

               In both approaches clicking a button in the first portal is needed to perform a script to update a field. That field is either the added match field of the second option or a field referenced in your portal filter with the first option.

               A filtered portal (option 1), however will not update as smoothly as you might like. The trick is to change your current relationship to include the field that your script updates when you click a button in the portal row.

               You use:

               Orders::fk_Contract_ID = Contracts::ID AND
               Orders::globalField x Contracts::any field

               where global field is a field defined in orders, with global storage specified and which your button's script sets to the selected Contract ID. It would then be used with this portal filter expression:

               Orders::globalField = Contracts::ID

          • 2. Re: Pop-up menu portal filtering and multiple related records

                 I went with the second option you proposed and everything works. Thanks for your help!

                 I however made a mistake and chose my reply as the best answer, my bad.