Filter Words from Column with String data type
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello World,
I have a field of records with a column (2017 YTD) with data type as string containing both double/float values as well as word. Sample:
2017 YTD
7.9
-0.04
0.02
On Target
On Target
On Target
0.047
0.37
100.00
0.389
which is being read in alteryx as
2017 YTD
7.9
-0.04
2.29E-2
On Target
On Target
On Target
4.7E-2
0.373
100
0.38900000000000001
What I need to do is filter the string 'On target' or any words that come up in the records or the float/double values from the column so that I have two separate columns with the same consistent data type (String and Double) from point of view of automating the process.
Any help will be appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
One option is you can use a Formula tool with two fields:
Number:
ToNumber([2017 YTD],1,1)
String:
IF IsNull([Number]) THEN [2017 YTD] ELSE Null() ENDIF
In the To Number function, the first argument is what we want to attempt to convert into a number, the second argument of 1 tells it to ignore errors so the results messages stay clean, and the last argument of 1 tells it to convert any non-number values into a null value. The second function uses the null result to know when the raw value is a string.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks Joe_Mako.
I used a filter thereafter to separate the Nulls and the select tool to remove the extra columns.
Thank you!
