3 Replies Latest reply on Jun 20, 2016 5:56 AM by ykoutroulis

    Script to search for ranges

    ykoutroulis

      Hi I have a number field and I am trying to write a script to use two inputs I am getting from the user and do the following search: min <= Field <= max

       

      How can I script this and perform the find?

      I have tried with one limit using "<" & Fieldname in the set field command and it works fine. How I can combine both limits?

        • 1. Re: Script to search for ranges
          CarstenLevin

          Hi ykoutroulis,

           

          You can set your script to enter find mode and set the value of the field you want to search within to [X...Y] with X and Y being your two outer points.

           

          Another way is to divide the search into two search records (not really needed), the first finding >X and the next omitting <Y

           

          Do you get the input from a dialog or from fields (global fields?) filled in by the user?

          If this is the case, consider validating those for being or not being logical. Also set error capture to "on" and do handling of errors (like no found records) yourself to avoid leaving the user in the dark.

           

          Does this help?

           

          Best regards


          Carsten

          • 2. Re: Script to search for ranges
            siplus

            Script:

             

            # calculate $yourMin and $yourMax, might be script paramters

            Enter Find Mode [ Pause: Off ]

            Insert Calculated Result [ Select ; YourTable::YourField ; $yourMin & "..." & $yourMax ]

            Perform Find []

            • 3. Re: Script to search for ranges
              ykoutroulis

              Thank you both,

               

              it worked like a charm