Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

Extract only month from filename

Miryana_26
5 - Atom

Hi I have a dataset with a lot of files that are named identically but for the different months.

The naming is : YY-MM-DD I want to create a formula only extracting the months from the file name.

 

Example of filenames:

Test_Database_2022-10-13

Test_Database_2022-01-02

Test_Database_2022-02-01

 

So, in this case at the end I should have months October (10), January (01) and February (02).

 

Can you help me create a formula? Thanks a lot!

6 REPLIES 6
gabrielvilella
14 - Magnetar

You can use Regex.

REGEX_Replace([FileName], '.+\d+-(\d+)-\d+.+', '$1')
ShankerV
17 - Castor

Hi @Miryana_26 

 

One way to achieve the solution is as below

 

ShankerV_0-1668691768392.png

 

 

Many thanks

Shanker V

 

ShankerV
17 - Castor

Step 1: Input

Next step:

ShankerV_0-1668691868207.png

 

 

Next step:

ShankerV_1-1668691888489.png

 

Nest step;

ShankerV_2-1668691903079.png

 

Next step:

 

ShankerV_3-1668691930796.png

 

Here is the output;

 

ShankerV_4-1668691956380.png

 

Many thanks

Shanker V

 

DenisZ
11 - Bolide

Please see attached workflow, hope it helps

 

DenisZ_0-1668692140475.png

 

 

 

binuacs
20 - Arcturus

@Miryana_26 One way of doing this

 

binuacs_0-1668693230288.png

 

DataNath
17 - Castor

Hey @Miryana_26, if your file names really are identical and always just end in the date, then you can use a simple string function - Right() - to isolate these last 10 characters and then just parse that Date as you wish:

 

DataNath_0-1668693488266.png

Labels