2 Replies Latest reply on Mar 26, 2014 12:00 AM by dinoapolito

    Portal Duplicates- Filtering



      Portal Duplicates- Filtering


           I have a "names" portal that displays duplicate names for a reason (I need and created it this way).  Above the portal I created a 1 row portal with a summary field that counts how many records are in the "names" portal below it via filtering.  I want to also create a 1 row portal that only counts the amount of unique names as well.  Is there a simple way to do this via filtering? Thanks

        • 1. Re: Portal Duplicates- Filtering

               I'm not sure that it's really simple, but it can be done. A simpler method is to use ExecuteSQL() if you have Filemaker 12.

               The portal filter method:

               Say that you have this relationship:

               LayoutTableOccurrence::PrimaryKey = PortalTableOccurrence::ForeignKey

               (any number of different relationships are possible here, I just need one to work from for what happens next.)

               Let's also assume that there is a PrimaryKey field in the portal's table that uniquely identifies each record.

               Create a new occurrence of the portalTable, call it UniquePortalTableOccurrence and link it to the original portalTableOccurrence:

               PortalTableOccurrence::ForeignKey = UniquePortalTableOccurrence::ForeignKey AND
               PortalTableOccurrence::NameField = UniquePortalTableOccurrence::NameField

               Then you can use this portal filter expression:

               PortalTableOccurrence::PrimaryKey = UniquePortalTableOccurrence::PrimaryKey

               and your filter will filter out all but the first instance of each name in the set of related records.

          • 2. Re: Portal Duplicates- Filtering

                 "A simpler method is to use ExecuteSQL() if you have Filemaker 12."

            How would you do this with ExecuteSQL()?

            I know SQL well but am at a loss at how to use it in FM