Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Filter using StartsWith and an Array of Phrases

hellyars
13 - Pulsar

Hi,

 

I want to filter using STARTSWITH and an array of values.  I tried this, but it does not work

 

!(StartsWith([HD], 'Notice|Policy|Transfer|Supplemental|Annex'))

 

Thanks!

3 REPLIES 3
jrgo
14 - Magnetar

@hellyars 

 

Alternate values don't work in most of the Alteryx functions other than with REGEX. You can either

 

NOT(
StartsWith([HD], 'Notice')
OR
StartsWith([HD], 'Policy'
OR
ETC...)

 

 

or

!REGEX_MATCH([HD], '^(Notice|Policy|Transfer|Supplemental|Annex).+$')

 

Jonathan-Sherman
15 - Aurora
15 - Aurora

The first way that comes to mind would be to use Regex_Match:

 

Regex_Match([Values], '^(?:Training|Checking).*')

 

This would check for values starting with "Training" or "Checking" and would not be case sensitive. You could add more after "Checking" using a pipe | delimiter between. So for example a third would be:

 

Regex_Match([Values], '^(?:Training|Checking|Testing).*')

 

If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.

 

Regards,

Jonathan

hellyars
13 - Pulsar

@jrgo 

 

Thanks.  The REGEX expression worked.  

!REGEX_MATCH([HD], '^(Notice|Policy|Transfer|Supplemental|Annex).+$')

 

Labels