6 Replies Latest reply on Jul 1, 2012 7:40 PM by vijaybhanabhai

    Find exact 2 contents in a field

    vijaybhanabhai

      How can i script a find to find 2 words (exact) in a filed using find then set field.

        • 1. Re: Find exact 2 contents in a field
          keywords

          If you mean that the two words you are looking for are the entire contents of the field the following script will do the job:

           

          Go to Field [ TableName::FieldName ]

          Enter Find Mode [ ]
          Set Field [ TableName::FieldName; "==word1 word2" ]

          Perform Find [ ]

           

          If you mean that either word could exist and you want to find each instance use the following version:

           

          Go to Field [ TableName::FieldName ]

          Enter Find Mode [ ]
          Set Field [ TableName::FieldName; "=word1" ]

          New Record/Request
          Set Field
          [ TableName::FieldName; "=word2" ]

          Perform Find [ ]

           

          Cheers!

          • 2. Re: Find exact 2 contents in a field
            vijaybhanabhai

            Thanks. I actually have a another field called date field which needs to be searched together with either word "Cash" or "Chq". I have  set up script as below

             

            Go to Field [ TableName::FieldName ]

            Enter Find Mode [ ]
            Set Field [ TableName::FieldName; "=word1" ]

            New Record/Request
            Set Field [ TableName::FieldName; "=word2" ]

            set Field "Date"

            Perform Find [ ]

             

            It doesnt work... no records are shown.

             

            What am i doing wrong?

            • 3. Re: Find exact 2 contents in a field
              comment

              vijaybhanabhai wrote:

               

              I actually have a another field called date field which needs to be searched

               

              Needs to be searched for what?

              • 4. Re: Find exact 2 contents in a field
                vijaybhanabhai

                Search for date which is entered by user

                 

                Sent from Vijay Bhanabhai 's iPhone

                • 5. Re: Find exact 2 contents in a field
                  comment

                  vijaybhanabhai wrote:

                   

                  Search for date which is entered by user

                   

                  Assuming it's entered into a global gSearchDate field, try:

                   

                  Enter Find Mode [ ]

                  Set Field [ YourTable::Datefield; gSearchDate ]

                  Set Field [ YourTable::Textfield; "Cash" ]

                  Duplicate Record/Request

                  Set Field [ YourTable::Textfield; "Chq" ]

                  Perform Find [ ]

                   

                  This is assuming that none of the other values in Textfield start with "Cash" or "Chq" - otherwise you will need to keep the = prefix, which slows down the search.

                   

                   

                  Note also that Go to Field [] does nothing in this context.

                  • 6. Re: Find exact 2 contents in a field
                    vijaybhanabhai

                    Hi. It finds the correct date but only the Cash not the Chq. ( i have inserted the =prefix to find exact match)