5 Replies Latest reply on Sep 28, 2016 8:14 AM by philmodjunk

    How to show related records of a selected portal record in another portal

    fmuser222

      Hi

       

      I am trying to show related records of a selected record in a portal but didn't find a way yet. Would I need a script that sets the filter in the second portal and is triggered when I select a record in the first portal?

       

      As an example: At an address there is a house (Table house), in each house there are one or more families (table family) with one or more family members (table members). I would like to have a layout where I can select a house, see the families in this house in a portal, select one of the families and see the family members in another portal.

      Or is there a better way than to use portals?

       

      Thanks for your advice.

       

      Roger

        • 1. Re: How to show related records of a selected portal record in another portal
          Johan Hedman

          This is how I would solve that problem.

           

          Create a Global Field in your Table that is Text format called ChosenFieldsPortal

           

          Have a button on the portal, so every time you click in your first portal have script run that sets your new global field to a calculation. You a script parameter ID from record in that portal

           

           

          Set field ( ChosenFieldsPortal ;

          Case(

          // If you already have that field in the ChosenFieldsPortal you want to delete that value

          Patterncount( ChosenFieldsPortal ; Get(ScriptParameter) ) = 1; Substitute ( ChosenFieldsPortal ; Get(ScriptParameter) ; "" );

          // Else add value

          ChosenFieldsPortal & "¶" & Get(ScriptParameter)

          )

           

          Then in your second portal you just have a Conditional Value that looks into your ChosenFieldsPortal if the ID of the records exists with Patterncount( )-function and set that portal record to another color for example

          • 2. Re: How to show related records of a selected portal record in another portal
            beverly

            not to step on Johan's excellent advice...

             

            There is a document and example on this forum under the Resources:

            "How To: All-in-One Parent-Child Layout"

             

            There are quite a few good things under the Resources, in fact!

            beverly

            • 3. Re: How to show related records of a selected portal record in another portal
              fmuser222

              Thanks for your quick reply.

              I will try this but it might take a few days. I'm primarily a sys admin and I only deal with filemaker on the side. That means, filemaker has to wait if there are other problems. But I will definitly answer.

               

              Roger

              • 4. Re: How to show related records of a selected portal record in another portal
                fmuser222

                After reading the "All-in-One Parent-Child Layout" how-to (which to me seems to suggest a similar approach as Johan's solution) I came up with the idea to have the button in the first portal (listing the families in my example) to call a script that sets a global variable to the family-id of the selected portal record and then filtering the related portal (displaying the family members) by this global variable.

                This works as expected but what are the drawbacks compared to the more complex solution you (both) suggested?

                Would my solution work in a multi user environment? More specifically is there only ONE instance of a global variable in a database or is there an instance for each user?

                 

                EDIT: disregard my last question, I found the answer: each user has its own set of global variables.

                 

                Cheers

                 

                Roger

                • 5. Re: How to show related records of a selected portal record in another portal
                  philmodjunk

                  I came up with the idea to have the button in the first portal (listing the families in my example) to call a script that sets a global variable to the family-id of the selected portal record and then filtering the related portal (displaying the family members) by this global variable.

                  This works as expected but what are the drawbacks compared to the more complex solution you (both) suggested?

                  I haven't read that other resource, but what you describe here is the typical method that I use for this type of layout setup. The fields in the first portal, BTW, can be formatted to be the button that updates the global field to control what appears in the second portal if you don't need to edit those fields on this particular layout.

                   

                  You can also place the second portal inside a popover and use Go To Object to open the popover. With a bit of slight of hand, this can be made to look like the popover is opening out of the side of the first portal. To use Go to Object to open a popover, Open the Popover while in layout mode, select the panel, not the button and use the Name box on the inspector's Position tab to give it an object name. To create the "out of the portal" illusion. Set the popover button's "Hide object when" setting to "True" to make it always invisible and position very close to or even behind the edge of your first portal.

                  1 of 1 people found this helpful