You are viewing limited content. For full access, please sign in.

Question

Question

Only taking a portion of data to name a folder/file

asked on June 11, 2020

Hello all,

Is there a way to name a folder in Workflow with only a portion of input data? For example, naming a folder with the last four digits of a social security number or the first three of a patients last name?

e.g. 123-45-6789 becoming just 6789 or YENNER becoming YEN

 

0 0

Replies

replied on June 11, 2020

Hi Whitney-

To expand on this a little, in case you're not familiar with Regular Expressions, within WF you can create new tokens via Pattern Matching--which I find a bit easier to see/read--or be a little more efficient and modify the token directly as Jim did.

For Pattern Matching, your examples would be:

  • Last 4 of SSN: you could get away with \d{4} meaning 4 consecutive digits, since that's the only part of the SSN where there are that many in a row. To get more precise you can append a $ which represents the end of the input string, like \d{4}$
  • First 3 of a name could use the ^ to indicate the beginning of the input, as ^\w{3}

 

It's fairly logical, but you have to think like a computer. And it can get a bit tricky if you need something more complex. One final recommendation, especially if you need to pull different parts of an input, is to write the whole expected pattern and then put parentheses around what you want. So, for the last 4 of an SSN it could be:

\d\d\d-\d\d-(\d\d\d\d)   or shorter using the curly braces   \d{3}-\d{2}-(\d{4})

2 0
replied on June 11, 2020

Hi Whitney,

You can use a regular expression to get the first/last X number of characters in the token.

  • First 3:  %(Token#<^.{1,3}>#)
  • Last 3:  %(Token#<.{1,3}$>#)

To change the number of characters, change the 3 in the formatting to whatever you want; so the first 5 is %(Token#<^.{1,5}>#)

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.