1 2 Previous Next 23 Replies Latest reply on Jul 9, 2012 4:36 PM by BeatriceBeaubien

    Counting Portal Rows with Filters

    Malcolm

      Am I overlooking something obvious? I want to count the items in a portal after the filtering . The usual methods ignore the filter because they look at the relationship, alone.

       

      Malcolm

        • 1. Re: Counting Portal Rows with Filters
          wimdecorte

          That's jus the way it is... filtering doesn't reduce the related found set, it just hides them from view.  If you're on 12 you can easily get a count using the new ExecuteSQL statement by specifying a sql query that includes your filtering criteria.  If you're on 11 you could the the same with a plugin.

          • 2. Re: Counting Portal Rows with Filters
            BeatriceBeaubien

            Hi Malcolm,

             

            You could set up a one row mini-portal with the same portal filtering with a Count() field in it. Admittedly this is a cludge, but as an interface visual cue it would work.

             

             

            Best wishes,

             

            Beatrice Beaubien, PhD

            i2eye, Toronto, Canada

             

            FileMaker Business Alliance

            FileMaker 11 Certified Developer

            Knowledge Translation Certified Professional

            • 3. Re: Counting Portal Rows with Filters
              Malcolm

              You could set up a one row mini-portal with the same portal filtering with a Count() field in it. Admittedly this is a cludge, but as an interface visual cue it would work.

               

              More explanation please: what would I be counting?

               

              Malcolm

              • 4. Re: Counting Portal Rows with Filters
                comment

                Malcolm wrote:

                 

                Am I overlooking something obvious? I want to count the items in a portal after the filtering . The usual methods  ignore the filter because they look at the relationship, alone.

                 

                No, you are not overlooking anything obvious. Portal filtering works on the layout level, while the "usual methods" work on the data level - thus ignoring the filtering.

                 

                If this is for display only, you could place a summary field (defined in the child table) inside a one-row portal with the same filtering applied. I believe that is what Beatrice meant in post #2 above.

                 

                If you need the count for further calculations, you could grab it from the same summary field's instance, using GetLayoutObjectAttribute(). However, it's not the best practice to base your calcs on layout attributes.

                • 5. Re: Counting Portal Rows with Filters
                  BeatriceBeaubien

                  What Michael said.

                   

                  Best wishes,

                   

                  Beatrice

                   

                  On Jul 7, 2012, at 5:25, Michael Horak wrote

                   

                   

                  created by Michael Horak in Advanced Discussion - View the full discussion

                   

                  • 6. Re: Counting Portal Rows with Filters
                    Malcolm

                    If this is for display only, you could place a summary field (defined in the child table) inside a one-row portal with the same filtering applied. I believe that is what Beatrice meant in post #2 above.

                     

                    OK. I see. Of course, there is no need for a portal object is there. I only need to place the summary field onto the layout to obtain exactly the same result.

                     

                    Unfortunately, the filter isn't able to be expressed in the relationship graph. The found sets are much larger than the portal can display.  I want to be able to give the user a record count so that they can quickly compare the effects of the filters.

                     

                    I'll use a small script that goes to the last portal row and gets the row number.

                     

                    Malcolm

                    • 7. Re: Counting Portal Rows with Filters
                      comment

                      Malcolm wrote:


                      Of course, there is no need for a portal object is there. I only need to place the summary field onto the layout to obtain exactly the same result.

                       

                      No, that's not true. If you place the same summary field outside a portal, it will show the count of all related (unfiltered) records.

                      • 8. Re: Counting Portal Rows with Filters
                        Malcolm

                        Of course, there is no need for a portal object is there. I only need to place the summary field onto the layout to obtain exactly the same result.

                         

                         

                        No, that's not true. If you place the same summary field outside a portal, it will show the count of all related (unfiltered) records.

                         

                        Maybe I missed something meaningful in your earlier post. I'll go back and have a look.

                         

                        Malcolm

                        • 9. Re: Counting Portal Rows with Filters
                          BeatriceBeaubien

                          Hi Malcolm,

                           

                          When you filter the portal, the related Count() will change based on the new constrained criteria based on the filter.

                           

                          This may seem obscure. If so, the the best way for you to understand it is to test the summary Count field defined in the Child Table with different portal filters applied to the portal.

                           

                          I hope this helps.

                           

                          Best wishes,

                           

                          Beatrice

                           

                          On Jul 8, 2012, at 22:03, Malcolm wrote

                           

                           

                          created by Malcolm in Advanced Discussion - View the full discussion

                          >>> Of course, there is no need for a portal object is there. I only need to place the summary field onto the layout to obtain exactly the same result.

                          >>>

                          >> No, that's not true. If you place the same summary field outside a portal, it will show the count of all related (unfiltered) records.

                          >>

                           

                          Maybe I missed something meaningful in your earlier post. I'll go back and have a look.

                           

                           

                          Malcolm

                           

                          • 10. Re: Counting Portal Rows with Filters
                            Malcolm

                            When you filter the portal, the related Count() will change based on the new constrained criteria based on the filter.

                             

                             

                            This may seem obscure. If so, the the best way for you to understand it is to test the summary Count field defined in the Child Table with different portal filters applied to the portal.

                             

                            Thanks for your persistence Beatrice and Michael. I've followed your instructions to the letter this time and, yes, it works as you described.

                             

                            Malcolm

                            • 11. Re: Counting Portal Rows with Filters

                              Hi all,

                               

                              Thanks Beatrice for this trick I didn't know. Although it works for count, I can't make it work for sum (total of). It keeps retiming the sum of all related records, regardless of the portal filter. Do you see the same ?

                               

                              Fabrice Nordmann

                               

                              Le 9 juil. 2012 à 12:10, Malcolm <noreply@filemaker.com> a écrit :

                               

                               

                              créé par Malcolm dans Advanced Discussion - Afficher l'intégralité du fil de discussion

                              When you filter the portal, the related Count() will change based on the new constrained criteria based on the filter.

                               

                               

                               

                               

                               

                              This may seem obscure. If so, the the best way for you to understand it is to test the summary Count field defined in the Child Table with different portal filters applied to the portal.

                               

                               

                               

                              Thanks for your persistence Beatrice and Michael. I've followed your instructions to the letter this time and, yes, it works as you described.

                               

                               

                               

                              Malcolm

                               

                              Répondre à ce message en répondant à ce courriel -ou- aller au message sur FileMaker Technical Network

                              Démarrer un nouveau fil de discussion dans Advanced Discussion par courriel ou à l'adresse FileMaker Technical Network

                              Gérer vos préférences email.

                               

                              FileMaker Developer Conference 2012 • Miami, Floride • 16-19 Juillet 2012 • www.filemaker.com/devcon

                               

                              • 12. Re: Counting Portal Rows with Filters
                                comment

                                Hi Fabrice,

                                 

                                any summary field - Count, Total, Average, Min, Max, etc. - when placed in a filtered portal, will summarize the filtered set.

                                • 13. Re: Counting Portal Rows with Filters

                                  Hi Michael,

                                   

                                  Really weird. Doesn't seem to work here. Can I send you a test file ?

                                   

                                  Fabrice

                                   

                                  Le 9 juil. 2012 à 15:40, Michael Horak <noreply@filemaker.com> a écrit :

                                   

                                   

                                  créé par Michael Horak dans Advanced Discussion - Afficher l'intégralité du fil de discussion

                                  Hi Fabrice,

                                   

                                   

                                   

                                  any summary field - Count, Total, Average, Min, Max, etc. - when placed in a filtered portal, will summarize the filtered set.

                                   

                                  Répondre à ce message en répondant à ce courriel -ou- aller au message sur FileMaker Technical Network

                                  Démarrer un nouveau fil de discussion dans Advanced Discussion par courriel ou à l'adresse FileMaker Technical Network

                                  Gérer vos préférences email.

                                   

                                  FileMaker Developer Conference 2012 • Miami, Floride • 16-19 Juillet 2012 • www.filemaker.com/devcon

                                   

                                  • 14. Re: Counting Portal Rows with Filters
                                    BruceRobertson

                                    Fabrice: maybe you could send your example that seems to show that it doesn't work; so it could be reviewed.

                                    1 2 Previous Next