2 Replies Latest reply on Nov 14, 2012 8:03 PM by richardalbert

    reverse filter function?

    deltatango

      Title

      reverse filter function?

      Post

      How do you do a reverse filter - like regular expression [^characters] (i.e. everything but) ?

       

      For example, I tried:

       

      If( 

      Filter(Lower(fieldToFilter) ; not "u123456789") <> ""; 1; 0

       

      But this did not work. 

        • 1. Re: reverse filter function?
          Steve Wright
            

          You could try this  http://www.briandunning.com/cf/922

           

           

          • 2. Re: reverse filter function?
            richardalbert

                 This is a pretty old thread but I think I have the right calculation if anyone out there is still wondering how to do this. I dont have filemaker installed on this computer so there is no way for me to know if this works 100% but here goes

                 Let(

                 [

                      ~Result = Substitute(fieldToExtractText;textToExtract;"");

                      ~Result = Substitute(~Result;"  ";" ");

                      ~Result = Trim(~Result)

                 ];

                 ~Result

                 )

                  

                 The first line of code removes the text you want to extract from the text field by replacing it by ""

                 If entire words are extracted from a field this will leave a double space because of the space that was before the word and the space that was after the word. that is what the second line of code is for. It replaces "  " with " ".

                 The third line of code gets rid of the leading space if the extracted text happened to be the first word or the last word in the text field.

                 There you have it. A reverse filter.