5 Replies Latest reply on Apr 26, 2011 7:16 PM by tomo17

    find exact match from value list scripting for ==

    tomo17

      Title

      find exact match from value list scripting for ==

      Post

      I am trying to find relevant records using a drop down values lists.  my issue is that three of the options include the same word "perth" ie north perth, south perth and perth.  When i choose north or south perth if works fine but when i enter perth i get all of the records for perth, north, and south perth.  I have tried to script for an exact match using the == operator that is suggested in other posts but am hitting brick walls.

      Here is the way that my database is currently set up:

      layout 1 is a 'switchboard' or main menu.  i choose a button "location"  scripted to take me to a new layout and enter find mode.

      layout 2 is a 'select search criteria' layout.  i have a drop down box that gives me values to choose and a button scripted to go to layout 3, and perform find records

      Layout 3 is the 'report page' where i am trying to pull up related data to the location chosen.

      I have tried to set field in the script button on layout 1 and/or layout 2 but no success

      As i stated earlier it works when the options north and south are chosen but not when just 'perth' is selected.

      Thanks

        • 1. Re: find exact match from value list scripting for ==
          Kays

          hey,

          try using == in found set , as i know == matches the whole field.

           

          K|Z

          • 2. Re: find exact match from value list scripting for ==
            philmodjunk

            In your script, you should have something like this:

            Make the fields for Layout 2 global fields and do not enter find mode until after they enter their criteria. That way, you can manipulate the criteria as needed in your find requests.

            Go TO Layout [//select layout 3 here]
            Enter Find Mode[]
            Set Field [Layout3Table::Location ; "==" & Layout2Table::GlobalLocationField ]
            Set Error Capture [on]
            Perform Find[]

            I haven't tried the following, but this script may work if you want to keep things the way they are and not use global fields. This script step assumes that you have already entered "Perth" in the location field while in find mode.

            Set Field [YourTable::Location ; "==" & YourTable::Location ]

            Try it out and see if it works or not.

            • 3. Re: find exact match from value list scripting for ==
              tomo17

              Thanks for the suggestions Phil.

              I have tried the second option that you suggested but this did not solve my problem.  Using this method i get no records returned.  the only way that i can get the results that i am searching for is to go to Layout 3 and then manually enter  ==Perth, then perform find.

              If i was to use your first suggestion with the global field how would i do this - do i need to have this set up seperately?

              • 4. Re: find exact match from value list scripting for ==
                philmodjunk

                Hmm, ran my own test and that second script should work. The script does successfully insert == in front of the text the user entered while in find mode anyway. I posted just a fragment of the total script here. You'd still need to perform the find after this step.

                To use a global field, you would place your global field on a layout, enter "perth" into and then perform the script. You can trigger the script with a button or a script trigger on the field.

                • 5. Re: find exact match from value list scripting for ==
                  tomo17

                  Thanks Phil - got it working.  Looks like i was using the wrong filed to use as the look up!