In case you missed the announcement: Alteryx One is here, and so is the Spring Release! Learn more about these new and exciting releases here!

Alteryx Designer Desktop Discussions

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

Want to truncate a field

rhearns1
8 - Asteroid

I am a newbie.  I am not a programmer.  I can do this in Excel, but the boss wants to use Alteryx.  So here I am.  My data is pulled from a HUGE data set that is has been parsed by a programmer into applicable fields for our use.  We are trying to set up a workflow to have the redundant tasks are automatic.  Simple... (NOT!)... anyway I need to truncate one of the fields.  An example in the column is (identifying information replaced with x's for the letters:   

 

1/17/2024 10:00:00 AM Txx Sxx Pxxx Txxx12 xx 

 

All I want is the date.  How do I do this?  Help please.

rene

 

 

7 REPLIES 7
ShankerV
17 - Castor

Hi @rhearns1 

 

One way of doing this.

 

ShankerV_0-1681217792543.png

([0-9/]+\s[0-9:]+\s.{2})

 

ShankerV_0-1681217833492.png

 

Or

 

ShankerV_0-1681218086301.png

([0-9/]+)\s

 

ShankerV_1-1681218111024.png

 

 

Many thanks

Shanker V

DataNath
17 - Castor
17 - Castor

Hey @rhearns1, if this field is consistently in this format then you could use something like this:

 

DataNath_0-1681217930161.png

 

The inner FindString() function looks for the first instance of a space.

The outer, Left() function then takes the first N characters of the string, where N is the index found by the FindString() within.

rhearns1
8 - Asteroid

Shanker, Thank you.  But the results included the time for which I do not want.

rhearns1
8 - Asteroid

This worked wonderfully!!!!!  THANK YOU!

TheUdbhav
8 - Asteroid

Hi @rhearns1 ,

Hope you are well.

You can simply use DateTime Function. Configure it to Convert "String to Date/Time Format" and specify the format of the incoming string. This will give you Date part.
Solution attached for your reference. Please let me know if I have further questions.

 

TheUdbhav_0-1681219340952.png



Thanks
 

HomesickSurfer
12 - Quasar

Hi @rhearns1 

 

If the date is the first word in your string, GetWord([Field1], 0) works.

rhearns1
8 - Asteroid

I would like to thank all for the replies.  I wasted 1 hour trying to figure this out!!!!! 👍

r

Labels
Top Solution Authors