Alteryx Designer Desktop Discussions

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

Decrementing the date field by 1 for 31 days and passing it to the workflow

Idyllic_Data_Geek
8 - Asteroid

I have a requirement to execute the daily workflow for last month. it should do it iteratively for each day and aggregate the data in the final output file. It should pass one date and let the workflow execute and then reduce the date by 1 and repeat. Can I use any calculation instead of using a macro?

Thanks in advance for your valuable time!

32 REPLIES 32
atcodedog05
22 - Nova
22 - Nova

Hi @Idyllic_Data_Geek 

 

One way to do it is to generate the previous 31 dates using the row generate tool and pass it through batch macro.

 

It may be possible without macro it totally depends on the logic you are applying.

 

atcodedog05
22 - Nova
22 - Nova

Hi @Idyllic_Data_Geek 

 

You can generate dates list using generate rows tool like below.

 

Workflow:

atcodedog05_0-1630341295858.png

 

And pass them as groupby into the batch macro.

 

Here is a resource on batch macro

https://community.alteryx.com/t5/Interactive-Lessons/Creating-a-Batch-Macro/ta-p/657923

 

Hope this helps : )

danilang
19 - Altair
19 - Altair

@Idyllic_Data_Geek 

 

Depending on your workflow, you can probably do it without a macro.  

-  Use a Generate Rows tool to duplicate your workflow once for every as-of date

-  include the as-of field as a key in all your Summary, Join, Sort, Multi-row tools and any other place there is a Group by option

- Replace any Append Fields tools with Join tools keyed on as-of unless you're appending fields that apply to all as-of dates

 

Run the converted workflow with just the original as-of date, i.e.  setup the Generate tools with a start of 1 and finish of 1.  Check the results against your original.  Then add 1 more date and check your results.  Once this is working run for the whole month

 

Dan

 

Dan

Idyllic_Data_Geek
8 - Asteroid

Thank you...I'm getting the below error.

 

Idyllic_Data_Geek_0-1630345427393.png

 

atcodedog05
22 - Nova
22 - Nova

hi @Idyllic_Data_Geek 

 

please check the below formula is there a variable rowcount if yes please replace it accordingly.

 

atcodedog05_0-1630345580217.png

 

Hope this helps : )

 

Idyllic_Data_Geek
8 - Asteroid

I got that much part figured out. Thank you..Now how do I use the batch macro to feed all these dates into my workflow 1 by 1?

 

atcodedog05
22 - Nova
22 - Nova

Hi @Idyllic_Data_Geek 

 

Can share me a snapshot of the workflow and tell me where exactly is the date being switched.

Idyllic_Data_Geek
8 - Asteroid

Idyllic_Data_Geek_0-1630346529428.png

 

There are bunch of dates in this formula tool which use DateTimeToday() to calculate the dates which are being fed down in the logic. The DateTimeToday() needs to be iteratively replaced by individual date of the month.

2) The output is obviously 1 file for one date. The logic needs to be changed so that it has the data for 30 days 🙂

 

atcodedog05
22 - Nova
22 - Nova

Hi @Idyllic_Data_Geek 

 

Refer to this interactive lessons modifying expression part. That should help.

https://community.alteryx.com/t5/Interactive-Lessons/Creating-a-Batch-Macro/ta-p/657923#done

 

If you are facing any issues let me know.

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels