3 Replies Latest reply on Oct 10, 2013 12:23 AM by appt

    Perform Find from Drop Down List

    jeffcrain

      Title

      Perform Find from Drop Down List

      Post

      Hi,

      Newbie.

      FM 11  Windows XP

      I have a database with several types of contacts.  They are categorized 'Contact Group A', 'Contact Group B', 'Contact Group C', etc.  I want a drop-down list on my main layout to be able to select a contact group from the list and display only those contacts for that particular group.  It is exclusive and don't need AND or OR or multiple selections.  Prefer to just select a value and when selected perform the find and not have to click a separate button to initiate the find.

      I am new to script and FM.  Any help is greatly appreciated.

      Thanks, Jeff

        • 1. Re: Perform Find from Drop Down List
          philmodjunk

          Define a text field and specify global storage in field options for it. I'll name it: gContactGroup.

          Place this field on your layout and format it with your drop down list.

          Write this script:

          #Must be performed on contacts layout
          Enter Find Mode[] // Clear pause check box
          Set Field [YourTable::yourContactGroupField ; YourTable::gContactGroup ] //gContactGroup must have global storage or this will not work.
          Set Error Capture [on]
          Perform Find []
          Sort [no dialog ; Restore ] //if you want them sorted, such as in alphabetical order

          Now enter layout mode, right click the gContactGroup field and select "Script Trigger". Since this is drop down list, use the OnObjectExit trigger to perform the above script. (With pop up menus or radio buttons, you can use OnObjectModify instead.)

          • 2. Re: Perform Find from Drop Down List
            jeffcrain

            Thank you very much.  It works great.  I appreciate your help

            Jeff

            • 3. Re: Perform Find from Drop Down List
              appt

                   Can someone now help me to take this one step further?

                   Lets say that you perform the find (in my case you are finding members of a particular cricket team). The find works and you can click backwards and forwards through the found set. 

                   However what i want to be able to do is have a drop down list that is populated after the find with just the names of the players that are in that team.

                   At the moment when I turn it into a pop up menu the only option seems to be to populate it with all records rather than just the found set.

                   I need it to work like this. Select a team, find only the players on that team, go to a layout ( a sort of training/lesson plan ) that has a bunch of say 5 different drop downs that are all populated only with the found names. The coach then selects one player per drop down so that you have 5 different players shown on the layout who are going to practice bowling during that session.

                   Next session, you might choose a different 5. There is no reason to store that data beyond the session on the day.

                   Hope someone can help as it is driving me nuts.