4 Replies Latest reply on Sep 22, 2011 4:46 PM by DmitriBorovoy

    php portal filtering - can't find info on how to make it work

    d4creative

      Title

      php portal filtering - can't find info on how to make it work

      Your post

      I have searched in every possible way, bought books, and experiments. I can not find any examples anywhere of how to use the setRelatedSetsFilters() command to filter the portal results on a web page. I have got portal filtering set up and working on a layout in my database.

      The documentation all says it can be done but NOWHERE does ANYONE show us how?!

      The PHP docs say to use it "with find requests".

      Here's what I have tried (amongst other ways):

          $findCommand =& $fm->newFindCommand($layoutName);
          $findCommand->addFindCriterion('CP_WebUsername', '=='.FM_USER);
          $findCommand->addFindCriterion('CP_WebPassword', '=='.FM_PSWD);
          $findCommand->setRelatedSetsFilters('layout');
          $result = $findCommand->execute();

      Please help. A simple example is all I need.

        • 1. Re: php portal filtering - can't find info on how to make it work
          littledrew_1

          hi, i've just run into the same issue, any luck since your last post?

          • 2. Re: php portal filtering - can't find info on how to make it work
            d4creative

            No. No answers at all.

            I think the portal filtering added to v11 does not affect the php engine. I think the documentation is referring to limiting the found sets to just a specific portal, but not to the portal filtering within that portal. Does that make sense?

            If you want to create the portal filtering in php you need to create a relationship with multiple conditions that include whatever filter you need.

            • 3. Re: php portal filtering - can't find info on how to make it work
              MatthewKweskin

              I was also trying to use setRelatedSetsFilters without luck. I could set via getRelatedSetsFilters and then use getRelatedSetsFilters to see the changes were set, but it doesn't seem to affect my results with getRelatedSet- maybe it's not intended for that.

              I followed David's advice and setup relationships that do the filtering I was previously acheving through the portals. One good thing I just discovered is that the sorting set in the portal does change the sorting of results from getRelatedSet.

              Another workaround that I used in my database is that I set the Record access for the privledge set that my PHP user uses to not allow access to items that would normally be filtered. I'm using PHP for a read-only version of the database. I have a field that's a flag if the record is ready to be viewed. In the Record data access section of the Privledge set, I set a custom privlege and limited access to the table when "Viewable = "Yes"". The result is that only viewable portal items are returned. This solution would only work if you never want to give PHP access to some records. 

              • 4. Re: php portal filtering - can't find info on how to make it work
                DmitriBorovoy

                I had the same problem with v11, until I discovered that my permissions were too restrictive.  One of my potals was sorted by a value list that the account I was using in PHP had no access to.  (doh)

                I didnt even have to use setRelatedSetsFilters().