3 Replies Latest reply on Apr 19, 2010 6:45 AM by Polarpro

    Finding an "exact value" in a field

    Polarpro

      Title

      Finding an "exact value" in a field

      Post

      Hey,

       

      I've got a field that can contain several values. The vales are separated by carriage returns.

       

      In record #1 the field contains

      002 A¶

      002A¶

      002

       

      In record #2 the field contains

      002 A¶

      002A

       

      My problem is that when searching for 002 both records match (as in record #2 002 is a part of 002 A). So, my question is: What can I do to search only for those records that contain exactly the value 002? =002 doesn't help and ==002 doesn't help either, as the latter searches only for records where the whole field content matches. "=002" didn't work either.

       

      I wonder if the only way to get done what I need is to add a  at the end of the last value in a field and search for "002¶".

       

      Any ideas?

      Thanks a lot  :-)  Mike

        • 1. Re: Finding an "exact value" in a field
          gczychi

          HI,

           

          if you are inside a script, try to add a carriage return character to the search string:

           

                  "searchstring" & char(13)

           

          (as far as I know, FileMaker still works with the old Macintosh cr character and not with the new unix line feeds (char(10))

           

          That should work.

           

          Gary

           

          • 2. Re: Finding an "exact value" in a field
            Polarpro

            Thank you,


            but in my case it does not seem to work. I tried to add both Char(13) and the "real" carriage return ().

             

            (Also tried to add Returns both at the beginning and at the end.)

            • 3. Re: Finding an "exact value" in a field
              Polarpro

              Hey,


              It seems as I've found a solution that works. I use the FilterValues function for it.


              For this, I first created a value list that contains all the values of the field. I call this value list "FieldValues". Then, in my script I have a step that says


              If

                 IsEmpty ( FilterValues ( ValueListItems ( Get ( FileName ) ; "FieldValues" ) ; "002" ) )

              Then...


              If 002 is not an element of this value list, then the script does certain script steps, if not, then other steps are being processed.

               

              Thanks again!

              Mike