Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Filtering a field for anything beginning with 16

rdeeparnell
5 - Atom

I have a set of data that I need to filter for the items that begin with 16 in a certain field.  This field is currently a double data type.  My first attempt was to change the data type to string using the "select" tool and then filter with the "starts with function" but I keep getting an error.  am I doing something wrong?  Can someone help me?

3 REPLIES 3
BrandonB
Alteryx
Alteryx

Maybe use a filter that uses an expression like

 

Left(ToString([Field]), 2) = "16"

atcodedog05
22 - Nova
22 - Nova

Hi @rdeeparnell 

 

You function should be something like this

 

StartsWith(ToString([Field]), '16')

 

Hope this works. If not whats the issue you are facing.

leon2020
7 - Meteor

hmm what was the error?  I guess some possible causes might be to do with nulls, zeros, non-numbers, or string type/length (v_string or vw_string type rather than just string).

 

For sanity's sake, because you can preview the field etc in designing, I would use a formula field, and create two fields.  One, call it TESTING and have type=V_String, enter ToString([field name]),2).  Second, call it FILTERING FLAG, type=Boolean, and enter TESTING="16".  Then, after those formulas, add a filter tool for cases where FILTERING FLAG is true.

 

Of course,you can do this directly in one filter tool, but the additional step may help pinpoint the cause of the error.  Coupled with a browse tool you can see how each record results, which will help you if you're still struggling (you can then play and test different formulas in the TESTING field).

Labels
Top Solution Authors