2 Replies Latest reply on Jan 9, 2017 8:05 AM by Jamieson Christian

    field expression check

    Y Lu

      can Tableau check field expression?

       

      for example  one filed may be  mixed numerical and alphabetic  B10 , and other could be pure numeric 225.

      if it was later one, then do calculation.

       

      how Tableau check it? no function can check, nether for loop function.

       

      has anyone experienced similar issue? such as UK post code pattern check?

       

      thanks

        • 1. Re: field expression check
          Wim Kegels

          Hi,

           

          You could use the CONTAIN() function to check for specific strings or letters, or you could create a REGEXP to check for any letters: [a-zA-Z]

           

          Hope this helps!

           

          Kind regards,

          Wim

          • 2. Re: field expression check
            Jamieson Christian

            Y Lu,

             

            As Wim mentioned, if you're looking for UK postcode patterns, REGEXP_MATCH() is probably the best way to detect them.

             

            Here's a calculation that returns True/False based on whether the postcode is recognized as a UK format:

             

            REGEXP_MATCH([Postal Code], '^[A-Za-z][A-Za-z]?\d\d?[A-Za-z]?\s?\d[A-Za-z][A-Za-z]$' )