9 Replies Latest reply on Jan 18, 2014 10:16 AM by erolst

    Multiple find criteria in one request field

    bobrace

      Is there a way to do a find based on multiple criteria in one request?  Example:

       

      Field = City

       

      Request = Chicago and Boston and Atlanta and Spokane.

       

      Another words, put all search criteria in one field (City) instead of using multiple requests.

       

      Thanks,

      Bob

        • 1. Re: Multiple find criteria in one request field
          wimdecorte

          Enter Find mode

          set field [ City == Chicago ]

          New Record / Request

          set field [ City == Boston ]

          New Record / Request

          set field [ City == Atlanta ]

          New Record / Request

          set field [ City == spokane ]

          Perform find

          • 2. Re: Multiple find criteria in one request field
            wimdecorte

            if you want your users to be able to put in all cities in one field you will have to create a script that takes that list of values and turn it into a scripted find request like above

            • 3. Re: Multiple find criteria in one request field
              bobrace

              Can you tell me if there is a way to reorder or alphabetize a a "Specified Find Request"?  I have an extensive "stored fine" and I would like to reorder that so I can see all my criteria in alphabetical order.

               

              Thanks

              • 4. Re: Multiple find criteria in one request field
                wimdecorte

                Why?

                 

                A scripted multiple-request find fires very quickly, why would you want to see them in some sorted fashion?  If you could see then what would you expect to do to that list?  The order is of no imporance to the find request.  They are all AND requests

                • 5. Re: Multiple find criteria in one request field
                  erolst

                  wimdecorte wrote:

                  They are all AND requests

                   

                  Well, every single one of them is an AND request, if you fill in more than one field, but taken as a group they form an OR request.

                  • 6. Re: Multiple find criteria in one request field
                    Mike_Mitchell

                    Bob -

                     

                    Your request is not clear (as evidenced by the crosstalk between Wim and erolst). Are you looking for:

                     

                    1) Any record where "City" contains ALL of "Chicago and Boston and Atlanta and Spokane"?

                    2) All records where any of the above cities is present in the "City" field?

                     

                    Mike

                    • 7. Re: Multiple find criteria in one request field
                      bobrace

                      Mike_Mitchell

                       

                      Thanks for asking for clarification and I apologize for the vague question.  It is the "All records where any of the above cities is present in the "City" field".  And the reason I would like to be able to edit this find request list is so that when items (cities) or what every search criteria needs to be added or removed, it can be edited easily to make sure those items are or are not in the stored find.  As you can imagine, the stored find is pretty big and to look through entries that are not alphabetized to see if it exists...  is a daunting task, especially when I have been previously added.  Plus, I would like another user to be able to easily modify this list.  It would be helpful to open the stored find and put it in alpha order after new requests have been added.

                       

                      Hope this makes sense.

                      • 8. Re: Multiple find criteria in one request field
                        Mike_Mitchell

                        That being the case, a single stored Find request is probably not the best approach. As Wim pointed out, multiple Find requests are required to perform an “OR” search (which is what you’re describing).

                         

                        Further, allowing users access to modify your scripts is typically a bad practice. No, a Bad Practice. No, a REALLY BAD PRACTICE.

                         

                        (Hope I wasn’t unclear.)  

                         

                        I suggest you set up a table where the cities can be recorded as records. In this way, you can:

                         

                        1) keep them sorted as you see fit

                        2) check for duplicates automatically through field validations

                        3) allow users to modify the table using appropriate access privileges without compromising solution security

                         

                        Then, when it comes time to perform the search, use Wim’s method of looping through the records. First, you’ll want to create a list of the values. You can do this either by using the List function from a related context, or by looping through the records and attaching each one in turn. Then, go into Find mode and loop over the list, creating a new Find request for each value. Execute the Find when you reach the end of the list.

                         

                        HTH

                         

                        Mike

                        • 9. Re: Multiple find criteria in one request field
                          erolst

                          Considering that there was this thread, I'm not sure which purposes the current one serves; except maybe to clarify: Yes, the sample code provided there is to write a script, not a calculation.

                           

                          Also, I think the question is not about letting users modify a script, i.e. the search requests within a script, but merely edit the field (or another source) that holds the search terms to be turned into requests.