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 wildcard "%"

treehook
7 - Meteor

Hi i'm trying to use Alteryx to only keep rows where a string field starts with a particular sequence such as the following:

 

XYZ1

XYZ2

XYZ3 

etc.

 

But i do not want it to keep rows where the string field contains XYZ but XYZ is not first 3 letters.ex: 

 

123XYZ1 

twfXYZ2 

 

 

I think the SQL code is equal to using "XYZ%" but i wasn't able to utilize this in Alteryx. It's probably something simple i'm overlooking. Any chance someone knows how to overcome this?

 

Thanks for your help!

 

6 REPLIES 6
treehook
7 - Meteor

To clarify, I'm needing this for a formula tool so it's the syntax to write this. Thanks!

MarqueeCrew
20 - Arcturus
20 - Arcturus

@treehook,

 

Here are a couple of ways:

 

Left([String_Field],3) = "XYZ"
&&
Length([String_Field]) > 3
Regex_Match([String_Field],"XYZ.+")

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Claje
14 - Magnetar

Another option is the STARTSWITH() function.

If you ran

 

STARTSWITH([String_Field],'XYZ')

This will do exactly what you are looking for.

 

 

Essentially:

 

STARTSWITH = SQL LIKE 'XYZ%'

CONTAINS = SQL LIKE '%XYZ%'

ENDSWITH = SQL LIKE '%XYZ'

treehook
7 - Meteor

All suggestions worked great! Thank you for the taking the time to share your knowledge.

MarqueeCrew
20 - Arcturus
20 - Arcturus

Thanks @treehook!  Please also mark @Claje as a solution too.  I have never used StartsWith().  I like it too  now :)

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
hcampbe1
5 - Atom

Is this possible to us the *startswith* option with multiple fields?  Is there succinct method to list multiple starting field values or are limited to Boolean in independent strings?

Labels