Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Multiple IF condition for Date and time

Pankhudri20
8 - Asteroid

Hello,

I have a per second data for each day and I would like to define a condition where any row which falls on a "Friday 12 am to 3pm" should be removed.

 

Can you please tell how can I achieve this in alteryx?

I have tried a lot of datetime functions and nothing seems to be working.

 

Thank you

Regards,

Pankhudri 

38 REPLIES 38
Pankhudri20
8 - Asteroid

Hi @atcodedog05 

 

The file name looks like this:

 

"Analytics-Data-2021-05-11-00-00-00.csv"

"Analytics-Data-":this is constant

2021: year

05: month

11: day

 

apathetichell
18 - Pollux

post screengrabs of your action tool and the formal tool it's leading into...  @atcodedog05 's solution should work for you.

 

basically formula should be set up as:

"Analytics-Data-"+datetimeformat("2021-05-11 00:00:00","%Y-%m-%d-%H-%M-%S")+".csv"

 

and action tool should be set up to replace specific string... specific string has to be:

2021-05-11 - date tool put in a date - not a datetime... so the time component of your .csv file name will be static.

 

Didnt' you already get an answer to your original question btw? You should mark it and start a new thread.

Pankhudri20
8 - Asteroid

Hello @apathetichell 

Thank you for your response.

I marked the solutions for the initial questions. I asked another questions here since it was datetime related.

I will open a new thread. 

 

Regards,

Pankhudri

 

atcodedog05
22 - Nova
22 - Nova

Hi @Pankhudri20 

 

Here is how you can do it.

 

Workflow:

atcodedog05_0-1627398531124.png

 

1. Using directory to point to the location with all file and get their info.

2. Using formula tool to extract date from filename.

3. Using filter tool to keep only files from 1st June.

4. Read these files using dynamic input tool.

 

Refer to the initial part of the video to understand more on dynamic input tool https://www.youtube.com/watch?v=ELfKYatOJZM

 

Hope this helps : )

Table of Contents Dynamic Input of Files: 1:00 Dynamic Input for SQL WHERE Clause: 8:16 Dynamic Input for SQL Stored Procedure Parameter: 14:09 A demo of three different way to use the Dynamic Input Tool: loading data from several files, replacing the WHERE clause of a SQL statement, and as input
Pankhudri20
8 - Asteroid

Hello @atcodedog05 ,

 

Thank you for your response.

I will check the workflow.

 

Regards,

Pankhudri 

Pankhudri20
8 - Asteroid

Hello @atcodedog05 ,

 

I wanted to ask I change how to do here. 

The workflow for dynamic input works fine but I have 2 types of file name.

 

 

 Analytics-Data 1-11-2021-05-11-00-00-00.csv

Analytics-Data 13-22-2021-05-11-00-00-00.csv

 

I have 2 different workflows for each type of file.

Can you tell me how to define 1-11- and 13-22- in the regex expression?

 

It would be really helpful if you can tell me this.

Thank you

Regards,

Pankhudri 

 

atcodedog05
22 - Nova
22 - Nova

Hi @Pankhudri20 

 

Slightly confused, can you tell me what are the dates in the above file names.

apathetichell
18 - Pollux

@atcodedog05I think the dates follow standard Alteryx date-time so "2021-05-11" is the date... no idea what 1-11 and 13-22 are

atcodedog05
22 - Nova
22 - Nova

Kind of agree @apathetichell may be the case. Just want to be sure🤔

 

Hi @Pankhudri20,

 

If the date in new filenames is 2021-05-11. The above same approach should work.

 

Hope this helps : )

Pankhudri20
8 - Asteroid

Hello,

 

Thank you for your response!

The dates are the same as before. Everyday 2 files are generated.

Analytics-Data 1-11-2021-05-11-00-00-00.csv

Analytics-Data 13-22-2021-05-11-00-00-00.csv

 

Analytics-Data 1-11-2021-06-11-00-00-00.csv

Analytics-Data 13-22-2021-06-11-00-00-00.csv

 

Analytics-Data 1-11-2021-07-11-00-00-00.csv

Analytics-Data 13-22-2021-07-11-00-00-00.csv

 

The only thing that changes in the filename is the date.

I want to load 1-11- and 13-22- in 2 separate workflows.

With the above solution it will load all the files and increase loadtime.

 

So how can I specify 1-11- or 13-22- in the regex formula?

 

Hope this helps.

Thank you

Regards,

Pankhudri

 

Labels