RSS

Visual Flow to Return Letters Only

07 Jun
Visual Flow to Return Letters Only

Have you ever wanted to extract just the letters out of a string? Here is a super quick Flow that you can use to do that. And with just a little tweaking you can adapt it to return additional characters to your liking!


Return Letters Only Flow

Letters Only Flow


Variables

Variables

  • count is initialized to zero

Formulas

Formulas

  • CurrChar = MID({!InputString}, count, 1)
  • IsLetter = REGEX({!CurrChar}, “[a-zA-Z]”)
  • LenInputStr = LEN({!InputString})

Flow Logic

  1. Check the character count against the length of the input string. If it is less than the length, proceed to next element
  2. Increment the character count variable
  3. Check the character in the input string in the count position with a REGEX formula to see if it’s a letter
    1. IsLetter
  4. If it’s a letter, add it to the output string

That’s it! Super simple, but could be really handy.


Other Possibilities

Regex is super cool. I know almost nothing about it, but am learning, and am putting together a little write-up to explain its basics, so stay tuned. In the meantime, here are some other possibilities:

  • Check for digits and letters:
    • REGEX(String, “[a-zA-Z0-9]”)
  • Check digits only:
    • REGEX(String, “[0-9]”)
    • This can also be written: REGEX(String, “\\d”)
  • Check for letters, period, space, hashtag, dash, comma, slash:
    • REGEX(String, “[a-zA-Z. #\\-,/]”)

Cheers!

Advertisements
 
1 Comment

Posted by on June 7, 2017 in Flow Tips & Tricks, Visual Flow

 

Tags: ,

One response to “Visual Flow to Return Letters Only

  1. Doug Ayers

    June 7, 2017 at 5:26 pm

    Neat trick! Particularly because it’s a no-code solution and because formula fields can’t leverage REGEX to extract text but rather validate (true/false) text matches an expression so your only alternatives are either this or apex.

    Like

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: