5 Replies Latest reply on Apr 8, 2013 9:01 AM by philmodjunk

    Finding number of rows in a portal

    med

      Title

      Finding number of rows in a portal

      Post

           I have designed a layout to search for names. The layout is based on a globals table which has searchname and type as feilds, the protal comes from the student tables which is related by

           globals::searname x student::name and globals::type=student::type

           the searching will be by entering the type into the layout (globals::type) and then entering awhole or partial spelling of the name into the layout (globals::searchname)

           I created a calculation field in globals to count stdent::name and I thought this will give me the number of matches but apparently it gives me the number of all student having the value entered for the type not of the name matches.

           How can I modify this to obtain the number of name matches.

        • 1. Re: Finding number of rows in a portal
          IT_User

               For:

               "globals::searname x student::name"

               Why is it a cartestian_join "x" and not an equal relation "="?

               X, that will bring up everything. (I'm not sure how it works with "globals::type=student::type")

               If you need the X, maybe create another TO and have the calculation depend on that relationship.

          • 2. Re: Finding number of rows in a portal
            med

                 It is actually a mistry to me how the x is working.

                 If I try the = then I have to type the whole name exactly otherwise I do not get any thing.

                 With the x I get all names containing the string of charcaters I typed for example.

                 I type part time for type and the characters GEO for searcname then I press enter which runs a script to commit

                 I get all part time students like George, Brown     Grogina, Smith     Cathy, Georgette    and so on.

            • 3. Re: Finding number of rows in a portal
              philmodjunk

                   It sounds like you have a portal filter that matches the text typed into the search field against the name field in the portal. This can be set up to support partial text matching.

                   In which case, you need the total related records that make it through the portal filter.

                   Define a Summary field in the student table. Set it to "count" a field that is never empty such as Student::Name.

                   Make a copy of your existing portal. Use portal setup to reduce the number of rows to 1. Put this summary field inside the one row portal it will show the number of matching names that appear in the portal.

              • 4. Re: Finding number of rows in a portal
                med

                     Yes I do remeber now that I am using a portal filter and this is how the cartezian relation is working.

                     I treid the portal copy with a summary field and it works fine as a display but what if I want to get this count and use it in calculation.

                     I really want to say that if the number of matches is one I do not have to wait for the user to click the selection but I go to the student layout automatically.

                • 5. Re: Finding number of rows in a portal
                  philmodjunk

                       Yes the summary field in a filtered portal is "display only".

                       To get the count as a number you can check in a script or other calculation, you'd need to either define a relationship that duplicates the matching done by the portal filter, but at the relationship level. OR, if using FileMaker 12, set up an Execute SQL calculation that replicates the same logic as the portal filter.

                       Both options are "easier said than done".