4 Replies Latest reply on Apr 1, 2015 2:04 PM by disabled_ntaylor

    getRelatedSet() from Layout with Multiple Portals of Same Table

    millennium

      Title

      getRelatedSet() from Layout with Multiple Portals of Same Table

      Your post

      We have a layout that has three portals based on the same table.  (i.e. Account record with one to many relationship to Transactions)  The related records presented in each of these portals differs based on the filter applied to each portal.  This works great for presenting transactions related to an account as Revenue, Transfers, and Expenses.

      However, when we list the portals in PHP using CWP, only one portal is listed although each portal has an object name of Revenue, Transfers, or Expenses respectively.  How can we use getRelatedSet() to retrieve records from each of these portals as distinct arrays of records?

        • 1. Re: getRelatedSet() from Layout with Multiple Portals of Same Table

          Cody:

           

          Thank you for the post.

           

          Please review “Filtering portal rows returned by find requests” on page 40 of the FileMaker® Server 13 Custom Web Publishing with PHP guide. 

           

          Specifically, the “The setRelatedSetsFilters() method takes two arguments:” part is particularly relevant. 

           

          The syntax does not reference a portal but a table or a layout. The names of the portals do not matter. If referencing a layout, then only one portal can be queried. So, either each portal will need to be based on its own table occurrence or if referencing the layout, then all records in a single portal can be found.

           

          TSFalcon

          FileMaker, Inc.

          • 2. Re: getRelatedSet() from Layout with Multiple Portals of Same Table
            millennium

            I agree with the statement in the guide which says, "In a solution that has many related records, querying and sorting portal records can be time consuming."  Unfortunately, it seems that the limitation of being able to only reference one portal and not being able to take advantage of the speed of different filters on multiple portals of the same table is unfortunate.  I think based on this, the matter belongs in the category of bug or poor design.

            Thank you for the reference as it would be helpful if I wanted to use a filter in some cases and not in others.  In this case, I need to use three filters on three portals.

            For others facing this same problem, the solution does seem to be to create multiple table occurrences, one for each portal/filter needed.

            • 3. Re: getRelatedSet() from Layout with Multiple Portals of Same Table
              millennium

              Dear TSFalcon,

              We've resolved to create relationships for each portal based upon the same table for any given layout, but can you confirm what is stated here: http://www.formulationspro.com/pages/filemaker/php_detail.php?id=116 specifically that setRelatedSetsFilters() does not actually use the portal filters defined for the portal when referred in a PHP query?

              The poster states, "What that means is that the 'layout' option is ignored. The only thing this feature does is limit the number of related records returned to the browser. It does NOT use the Portal Setup dialog box settings to filter the records. FileMaker will be updating the documentation in a future release to correctly document the features of this method."

              This would mean that for each filter, we must create a different table occurrence and relationship, not only a different table occurrence and relationship for each portal?  Has this been documented anywhere?  It sounds like the first argument is useless for setRelatedSetsFilters().  Can you help us understand how it might be used in an example?

              • 4. Re: getRelatedSet() from Layout with Multiple Portals of Same Table

                Cody:

                 

                Thank you for the reply.

                 

                Please review the forum thread where this was reported:

                 

                PHP setRelatedSetsFilters Does Not Work

                 

                Your current understanding is correct. Additionally, I have added your comments to the original report made to Testing and Development and alerted the Documentation department. 

                 

                TSFalcon

                FileMaker, Inc.