1 Reply Latest reply on Sep 21, 2010 2:36 PM by philmodjunk

    Script for searching multiple fields

    maggie@cahen.net

      Title

      Script for searching multiple fields

      Post

      We run an art gallery and have artwork moving from in-house to conservators, framers etc. I have 8 fields in my movement report - 'movement from' 1 - 4 and 'movement to' 1 - 4. I want to write a script that will find, for example : Field 'Movement from 1' contains 'x' OR 'movement to 2 contains 'x'. I have only been able to get as far as 'Movement from 1' contains 'x' AND 'movement to 2 contains 'x' which obviously will show no return. Any advice much appreciated.

        • 1. Re: Script for searching multiple fields
          philmodjunk

          I'll answer your specific questions first, but then I'm going to suggest you change your database structure to a more optimal design.

          The way to include OR in your find logic is to put your criteria in separate Requests. Think of each "request" as a blank record where you specify criteria for a find.

          Enter Find Mode

          1. Put 'x' in field 1
          2. Select new request from the requests menu
          3. put 'x' in field 2
          4. Select new request from the requests menu
          5. Put 'x' in field 3
          6. Select New request from the requests menu
          7. put 'x' in field 4
          8. perform the find

           

          This will find all records with x in field 1 or field 2 or field 3 or field 4.

          Now for a design change suggestion: Instead of 4 dedicated fields for this, it would be much more flexible to create a related table of movement reocords and put them in a portal on this layout. This allows you to document any number of "movement" events and makes possible much more flexible report options if you need to create a report tracking an artwork's movement. Coincidentally, with such a portal, you'd only need to specify 'x' in the first row of the portal while in Find Mode to find all records where x is listed in any of the portal records--giving you your OR based logic in even simpler format than above.