3 Replies Latest reply on Mar 17, 2011 9:24 AM by philmodjunk

    Finding and sorting items in a portal



      Finding and sorting items in a portal



      I'm making a Rolodex. The main layout has fields for all the name/address info and a portal that lists all of the contacts.

      There is a table called Rolodex and a duplicate table (Rolodex_2).  Rolodex:(autoserial) <-- ≠ --> Rolodex_2:(text field)

      I want to insert all the letters of the alphabet as buttons. When the user clicks "H" the first last name that starts with H appears at the top of the portal but all of the other contacts remain. Sort of like the contacts app on an iPhone.

      I'd also like to have a find field. The user types "Joe" and clicks a button and all of the Joes show up in the portal. This one seems easy but I'm stuck..


        • 1. Re: Finding and sorting items in a portal

          This all can be done with sufficient scripting and a portal filter, but I wonder if you truly need both. A find box would seem to do everything the letter buttons would do plus a lot more...

          Working just with the find field, here's a way to set this up where you do not even need to click a button:

          Define a filter expression for your portal filter as:

          PatternCount ( Rolodex_2::NameField ; Rolodex::searchField ) //matches to any records where the name field contains the text in the search field.


          Left ( Rolodex_2::Namefield ; Length ( Rolodex::SearchField ) ) = Rolodex::SearchField   //matches to any record starting with the serach text

          Use the OnObjectModify script trigger to perfom this script:

          Refresh Window [flush cached join results]

          to force the portal to refilter with each letter entered, changed or deleted from the search field.

          In many applications of this technique, it's helpful to specify global storage for the search field--particularly if this database is to be shared over a network.

          • 2. Re: Finding and sorting items in a portal

            You are right! I don't need the letters at all. This is much better..

            I'm sure I'm missing something...

            I tried both methods which work except that you have to click out of the SearchField or press ENTER for it to search. I tried the OnObjectKeystroke script trigger too.

            I prefer the PatternCount method but when the SearchField is empty then the portal is empty. Once I type in the field and click out it displays results. When I use the "Left" method the portal contents are visible when the SearchField is empty.

            Thanks so much for your help! 

            • 3. Re: Finding and sorting items in a portal

              You need to use the OnObjectModify trigger set on the search field. I just went and checked a file where I used this tool. I find that I used this script with the OnObjectModify script trigger:

              Commit Record
              Refresh Window [Flush Cached Join Results]