4 Replies Latest reply on Apr 21, 2014 3:02 PM by BillPlunkett

    Filter Portal

    BillPlunkett

      Title

      Filter Portal & refresh

      Post

           Hello.

           I have a portal showing a list of Contacts next to a form with an individual's details.  All's working fine when clicking on a contact and the person's details showing in the form.

           Now I want to filter the set of contacts in the portal if the user clicks a checkbox or enters characters in a text field.  Just to get me started, when the user clicks a checkbox, say for contacts who are cash donors to the foundation, how do I write the script to filter and redisplay the portal?  Just as important, when they uncheck the checkbox?

           thanks, I know I will get a solution because this is a very responsive forum.  Thanks to everyone who participates.

           Bill

      FilterQuestion.png

        • 1. Re: Filter Portal & refresh
          philmodjunk
               

                    Just to get me started, when the user clicks a checkbox, say for contacts who are cash donors to the foundation, how do I write the script to filter and redisplay the portal?  Just as important, when they uncheck the checkbox?

               I wouldn't use a script or a portal filter for that.

               Define a text field as SelectedContactTypes in your layout's table so that you can use SelectedContactTypes as a match field in the portal relationship and format it with check boxes format with a value list of the contact types shown in your screen shot.

               Then, you can select or deselect any number of check boxes in this field and the portal will automatically update to show the matching contacts with that specified type in the contact type field of the contacts records. And no scripting or portal filter expression is needed.

               This works due to the special match fields that store a list of return separated values work in a FileMaker relationship.

               If you clicked the check boxes for "Cash Donor" and "Item Donor" in SelectedContactTypes the two selected values are stored in the same field separated by a return. If this is match field in the portal's relationship, you would get a match to all contacts records with a donor type of "cash donor", "item donor" or both.

          • 2. Re: Filter Portal & refresh
            BillPlunkett

                 I'm missing something here.  I already do have a text field in the table that is a list of the "types" that have been checked for each record.

                 I have the check boxes to filter the portal as named objects:  CB_CashDonor, CB_ItemDonor, CB_Bookstore...

                 Do I define a $$Global variable to build an equivalent string to compare to the string in the table?  I can't figure out how to reference an object (such as the CB_CashDonor) in the definition of the variable.

                 I build the string in the table per the attached screenshot of the script.

                 I'm sorry but I get the general idea of what you are saying but I am missing how to execute it in code.

                 Further help is GREATLY Appreciated.

            • 3. Re: Filter Portal & refresh
              philmodjunk

                   The point that I am trying to make is that if you use the check box field as a match field in the relationship, you don't need a portal filter at all.

                   See this demo file for a simple example: https://dl.dropboxusercontent.com/u/78737945/CheckBoxesPortalFilterDemo.fmp12

              • 4. Re: Filter Portal & refresh
                BillPlunkett

                     Okay, now I get it.

                     Sorry for being a little dense.

                     thanks