3 Replies Latest reply on Apr 27, 2016 10:46 AM by alquimby

    Jump To/Select Record using Button Bar



      I have a portal on a layout which is a list of all the clients.  It's sorted by last name, first name.

      I wanted to use the handy button bar in FM 14 as a way to jump to records in the portal where the surname begins with that letter clicked.  I do not want to filter all the records out, I just want to jump to the first record with the last name that starts with whichever letter I click.  Is there a way to do this?  I've attached a screenshot of what I have.


      I may be missing something in the script because it's not working.  So either I'm using the wrong script step out of ignorance or need additional steps.  I have a generic script that I can use for each letter, setting the script parameter as the letter on that particular button, going to the object (portal) and thought maybe the pattern count of variable to last name somewhere but am missing how to get it to actually jump to the first record it finds.


      Anyone done something like this yet or know how to get it to work.  Should be fairly straight forward, I would think.

        • 1. Re: Jump To/Select Record using Button Bar

          Assuming your portal is sorted by name, you could do something like this:


          Set Variable [ $letter ; Value: Get ( ScriptParameter ) ]

          Go to Field [ portalTable::Name ]

          Go to Portal Row [ First ]


               Exit Loop If [ Upper ( Left ( portalTable::Name )) = Upper ( $letter ) ]

               Go to Portal Row [ Next ; Exit after last ]

          End Loop


          Then just attach this script to each button bar segment with a parameter equal to the letter you want for that segment.





          (P. S. If you can guarantee the letters will always be uppercase, you can omit the Upper function.)

          • 2. Re: Jump To/Select Record using Button Bar



            Didn't think I'd have to do the loop.  Not sure why I didn't think that..but...yeah.


            Thanks so much!

            • 3. Re: Jump To/Select Record using Button Bar

              If I understand what you want correctly (the desired last names by first letter to appear at the top of the portal), there's a way to do it without the button bar and script:


              In your Client table create a calc for a field called FirstInitial defined as Left ( Last Name ; 1 ), and a global text field to hold one letter of the alphabet. Create a self join relationship to your client table where the FirstInitial field is greater than or equal to the global field in the main table.


              Create an alphabet value list (each separated by a carriage return). Put your global field where your button bar is, but long enough to get all 26 letters of the alphabet and attach it to the value list. Make it a radio button. Now when you click one of the letters all last names greater than or equal to the letter clicked will appear in the portal. Of course, if

              you want only last names beginning with letter clicked to appear, just change the relationship to FirstInitial equals global field.


              Al Quimby