2 Replies Latest reply on Nov 25, 2016 9:39 AM by philmodjunk

    Setting a script step as "or" instead of "and"

    ProdMan

      I am setting up a script where I want to find all records which contain X in field 1 or y in field 2 (two unrelated fields), but the script automatically adds "and" between the two script steps. How do I create two script steps with "or", so that it finds all relevant records which contain one or the other qualifying records? If I simply add the second find (for field 2) after as a distinct "find" action, then obviously it only finds those records that qualify for field 2.

      I've attached a screen shot of the script step where "and" automatically appears.

        • 1. Re: Setting a script step as "or" instead of "and"
          erolst

          I suggest you use the slightly more verbose, but easier to understand combo of Enter Find Mode - Set Field - Perform Find:

           

          Then you need to add a new request, using the NewRecord/Request step.

           

          Example: to find all objects that are blue OR spherical:

           

          Enter Find Mode [ no restore ]

          Set Field [ MyObjects::colour ; "Blue" ]

          New Record/Request

          Set Field [ MyObjects::shape ; "Sphere" ]

          Set Error Capture [ on ]

          Perform Find

           

          ProdMan wrote:

          If I simply add the second find (for field 2) after as a distinct "find" action, then obviously it only finds those records that qualify for field 2..

          That is a viable option if you choose Constrain (i.e. the found set) rather than Find. Comes in handy for performing scripted searches combing multiple ORs.

          1 of 1 people found this helpful
          • 2. Re: Setting a script step as "or" instead of "and"
            philmodjunk

            +1 on erolst's recommendation.

             

            If you are interested, here are some other scripted find examples--including some methods for getting "or" results:

             

            Scripted Find Examples