3 Replies Latest reply on Feb 3, 2015 9:23 AM by philmodjunk

    Search in several fields at once

    Maikel

      Title

      Search in several fields at once

      Post

      As you can see in the screenshot, I use a show custom dialog to bring up a search on multiple fieldsThis search works well when i'm searching just for one word that corresponds to one of the fields. 

      Now my question is; Is it possible to type multiple-word that corresponds to one of the fields "for example".

      Search field " *Car* *LM* "
      >> Search field 1 >> Car <record1>
      >> Search field 2 >> Ford  <record4>
      >> Search field 3 >> KLM  <record9>

      In this example we assume that the "search fields" are not equal to each other and that the search shall be performed over multiple record.

      When the search is as above, the result must show record one and record three as a result.

      Screen_Shot_2015-02-03_at_09.21.48.png

        • 1. Re: Search in several fields at once
          SteveMartino

          Did you try using Quick Find?  I have multiple instances in my DB where I use a global field with a script trigger to search for a word/phrase in multiple fields at once.

           

          -Or-

          In your example, if you are looking for $project in any of the four fields, you would use an 'OR' request

          Your script here...with set $project steps, then :

          Enter Find Mode []

          Set Field [Table::field1; $project]

          New Record/Request

          Set Field [Table::field2; $project]

          New Record/Request

          Set Field [Table::field3; $project]

          New Record/Request

          Set Field [Table::field4; $project]

          Perform Find [] //no parameters

           

          • 2. Re: Search in several fields at once
            Maikel

            Sorry, this solution is another way to achieve the same as the tool that I developed myself. So it does not answer my question. :(

            The difficulty in my question is that I want to type several words next to each other separated by a space or a symbol same as in my example. 

            Search field " *Car* *LM* "
            >> Search field 1 >> Car <record1>
            >> Search field 2 >> Ford  <record4>
            >> Search field 3 >> KLM  <record9>

            When the search is as above, the result must show record one and record three as a result.

            Actually I like to ask filemaker to distinguish the words from each other and make a search $variabele of it. in my example the words car and LM should be calculated in separate variables to search a field on Car and field LM.

             

            • 3. Re: Search in several fields at once
              philmodjunk

              I think that your "search field1", "search Field 2", example is misleading us as to what you are trying to do.

              If you were to do a manual find, would the following produce what you want?

              enter find mode.

              Put *Car* in to a field

              create a new request

              Put *KLM* in to the same field that you put *Car*, but in this new request.

              Perform the find to find your record 1 and record 3 as your found set.

              If so, a looping script can parse each criteria and either put each into a different request or perform a find followed by a series of extend found set actions to find the desired records.

              MiddleWords with a loop variable could be used to extract each such criterion one at a time for use in building these find requests and I would use a global text field as the custom dialog's input field as this makes the script simpler.

              A similar looping script example can be found as one of the scripted find examples listed here: Scripted Find Examples

              But that example parses data separated by returns instead of spaces and uses getValue where you would need to use MiddleWords.