6 Replies Latest reply on Jan 4, 2012 9:36 AM by philmodjunk

    Filter Portal Records with a Button



      Filter Portal Records with a Button


      I have a layout and have put a portal on it. Also on the layout (outside the portal) and I have put a few buttons to filter the records that are shown in the portal. How do I go about scripting the buttons so they do this?

      The portal is of a table instance of the current table if that helps. Thanks for your help.

        • 1. Re: Filter Portal Records with a Button

          What is the relationship used to make your portal happen?

          What filter expression, if any have you set up?

          What kind of filtering do these buttons need to do? Can you give an example?

          • 2. Re: Filter Portal Records with a Button

            I made a 2nd instance of the original table. I don't have any filter expression set-up yet, no.

            It's basically a list of clients, one filtering example would be if they have any active orders etc...

            Thanks for your help.

            • 3. Re: Filter Portal Records with a Button


              I have a doubt why you want to filter the portal by button.

              If that relationship means the occurance have stored and index field then no need to filter this .

              if not then go  for fixing it or take help of script.



              • 4. Re: Filter Portal Records with a Button

                Well there will be several different buttons, each with a different filter criteria. Cheers.

                • 5. Re: Filter Portal Records with a Button

                  Ok Means you are trying to filter 1 tables record under different criteria... then

                  Take one global field on that table.Set its value on each button click.

                  In relationship make sure the global field must related with the the field that holda all the criteria value.

                  I think this will help you.


                  • 6. Re: Filter Portal Records with a Button

                    A more detailed description of what you want to do with the portal filtering will help us to help you.

                    Say you want to see a list of all clients with at least one order record where status = "active".

                    Set up these relationships:

                    Clients::gSelectedStatus X AllClients::Refresh

                    AllClients::ClientID = Orders::ClientID  

                    Define Refresh to auto-enter Clients::gSelectedStatus

                    Use this filter expression:

                    IsEmpty ( Clients::gSelectedStatus ) or ValueCount ( FilterValues ( List ( Orders::Status ) ; AllClients::gSelectedStatus ) )

                    The IsEmpty clause will cause all records to show if gSelectedStatus is empty. The expression to the right of the Or operator pulls up a list of all order statuses for each client and returns the number of orders with a status matching the value in gSelectedStatus. Any value other than zero evaluates as True---causing that client record to be displayed in the portal.

                    Now your buttons can use set field to modify the value in gSelectedStatus to change what records appear in the filter or you can format gSelectedStatus with a value list and just select the status you want from the field's value list.

                    Note: Using the specific combination of match fields in the cartesian join, plus the refresh field with its auto-enter calculation is a technique posted here in the forum by Mark Gore that avoids the need for the Refresh Window [flush cached join results] step to get the portal to update after selecting a value in the global filter field.