4 Replies Latest reply on Aug 19, 2011 11:57 AM by Kat11_1

    Portal filter



      Portal filter


      I have a file  (FMPro 10) that holds Customer Information records and a file that holds each Customer's Service records. Each service can fall in one of the three categories. Category A, Category B or Catgory C.

      I would like to set up three tabs (one for each category) that would list only the services that fall under the coresponding category (tab) for a particular customer. So that an user could click betwenn tabs and you would only see the service under that category for this customer.

      I think I need to create a self joined table using Customer ID and Category field but I am lost as how to go about seting the "filter for a tab.

        • 1. Re: Portal filter

          You are on the right track. If you had FileMaker 11, you'd have the option for using a portal filter expression in Portal Setup, but since you are using 10, you'll need to implement the filter on the relationship level.

          The first trick is to create a separate "table occurrence" for the portal's table, for each such portal. Open Manage | Database | Relationships, select the "box" for your Customer Service Table and use the duplicate button (Has two green plus signs), to make three new copies of the selected table occurrence. (Each "box" in this window represents a "table occurrence".) You can double click each of these new occurrences to bring up a dialog where you can rename them so that it's easier to tell the purpose for each of these new occurrences.

          Since you want separate tabs and separate portals, we'll need to use a different calculation field that "hardwires" each relationship to filter for a specific category. Define three fields of type calculation, constCatA, constCatB, constCatB. Define each calculation to return a specific value that matches one of the category values. If "Computer" was one of your categories, the constCatA field might be defined with just "Computer" in the calculation dialog and "text" selected as the calculation's return type.

          Now you can set up different relationships to each of your new occurrences to get these relationships:

          CustomerInfo::CustomerID = CatAServiceRec::CustomerID AND
          CustomerInfo::constCatA = CatAServiceRec::Category

          CustomerInfo::CustomerID = CatBServiceRec::CustomerID AND
          CustomerInfo::constCatB = CatBServiceRec::Category

          CustomerInfo::CustomerID = CatCServiceRec::CustomerID AND
          CustomerInfo::constCatC = CatCServiceRec::Category

          Now you can place a portal to CatAservicRec on the category A tab, CatBServiceRec on the Category B tab and so forth...

          An alternative is to use one portal and no tabs, with a single text field formatted with a value list for selecting a category. This can even be a check box field where selecting both Category A and Category B displays both categories in the portal.

          This would use a single relationship that would look like this:

          CustomerInfo::CustomerID = CatServiceRec::CustomerID AND
          CustomerInfo::SelectedCategory = CatServiceRec::Category

          Where SelectedCategory is the field you'd place near your portal and format it with a value list of your Categories.

          • 2. Re: Portal filter

            Awesome. I will need to use the 1st solution even  though the 2nd one is more elegant (and less work :). I need to display a bunch of other category related data on each of the Category's tabs so this way will work.

            Thanks again!

            • 3. Re: Portal filter

              It's possible to use the second method with multiple tabs and anObjectEnter script trigger to perform a script to select the appropriate value in the filter field. But the script for this gets sufficiently cumbersome that it's kind of a "wash" as to which is the simpler approach to use.

              • 4. Re: Portal filter

                Thanks for mentioning it though!