3 Replies Latest reply on Jul 7, 2010 2:05 PM by philmodjunk

    Scripting Multiple and Variable Find Requests

    jda76

      Title

      Scripting Multiple and Variable Find Requests

      Post

      I've been working on an search module that is becoming increasingly more complicated for me.  I'm hoping there is a simpler way to do it.

      I've created a layout which is basically a form of global fields that the user fills out and then runs my find script which plugs in all those values in find mode.  Then I was told that two of the fields had to allow for multiple entries.  So, I allowed up to four entries in each of those fields (as repeating fields), filled up my script with a bunch of nested IFs to search for each possible combination.  NOW, it is being requested of me that a third field allow for multiple entries for the find.... in lieu of scripting each possible combination, is there a simpler way to do this?

      Example Search:

      Field1     Field2     Field3

      A            J            X

      B            K           Y

      C                         Z

      D

      Example Results:  AJY, CKX, DKZ, AKZ. . .

      The find results must match criteria from each of the fields, which may have 1-4 values (currently).  I would like to allow for more if the process can be simplified.

      Thanks for any ideas.

      I've been developing for my company for 5 years.  Using FM 11, FM Server 11, and FMA 11 on PCs mostly, Windows XP

        • 1. Re: Scripting Multiple and Variable Find Requests
          philmodjunk

          Can you format these multiple entry fields as a single check box formatted field?

          Is this a case of matching exact values or do you need to match partial strings and/or individual keywords such as entering "apple" and getting "apple Juice" or "Applesauce"?

          If they are only exact match criteria, you may be able to set up a Go To Related Records script step as a list of values or individual values in a repeating field can be used to match records that match any one of the listed values.

          Another option is to set up a series of nested loops to step through your global field (or the values listed in a check box field ) setting criteria and creating new requests as needed.

          • 2. Re: Scripting Multiple and Variable Find Requests
            jda76

            Thanks for the reply....

            It does need to be an exact match, however, there are at least a hundred values in these fields so a checkbox would be unweildy.

            I like the Go To Related Records idea, but one of these three fields isn't required.... Guess I could create two relationships and check to see if the non-required field is empty and use the relationship that doesn't use that field.

            Hmm... I'll do some playing around.

            • 3. Re: Scripting Multiple and Variable Find Requests
              philmodjunk

              Really long lists can be displayed as scrolling portals with a selection check box, that's yet another approach and requires a bit more programming--but it can be a very useful approach--you can even set up filter controls on the portal (even in pre filemaker 11) that pull up smaller subsets of the total list.

              Also, don't forget Constrain Found Set, you can pull up a set of records as step one and then use constrain to filter it down to the final set of records.

              If you want to continue the dialog, feel free to post a more detailed description of how you want each of these repeating fields to function in specifying criteria.