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

Macro question - workflow needs to rerun based on condition

Pingu
10 - Fireball

Hello Alteryx community,

 

I could use some best practice tips on how to best solve this workflow based on what I need. I have a workflow that downloads events from an api, but it only returns up to 499 events. So in case 499 events are returned the workflow needs to run again completely. If there are between 0 to 498 events the workflow does not need to run again. 

 

The amount of events is calculated with the summarize tool at the moment.

 

Is it possible with this design or do I need to do a complete overhaul to use macro's?

 

Pingu_0-1605102004350.png

 

4 REPLIES 4
estherb47
15 - Aurora
15 - Aurora

Hi @Pingu 

When you want to loop through a workflow based on a condition, you'll want to use an Iterative macro. 
There's a great e-Learning here: https://community.alteryx.com/t5/Interactive-Lessons/Creating-an-Iterative-Macro/ta-p/657925

Just be sure that you have a way to update the API call so that it returns the next set of results, before you make the call in the download tool.


Let me know if that helps.


Cheers!

Esther

MarqueeCrew
20 - Arcturus
20 - Arcturus

@Pingu ,

 

 if on call #1 you know how many calls you need, instead of wrapping this up in a macro I would use a GENERATE ROWS tool to create the URL strings necessary and feed them into another DOWNLOAD tool.   Example would be to modify the page# o each record or change a query parameter. 

cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Pingu
10 - Fireball

Thank you for your answers MarqueeCrew and EstherB47

 

The amount of calls is not known beforehand unfortunately.

 

The download tool does not need to be updated. The call returns all 'unseen events' but only up to 499 at a time. So the next time it is called it will return the next 499 until there are no more left so the last call is always between 0 and 499. So if it is called very often it is always <499. But I do not think work will appreciate if i abuse our Alteryx Server for hourly runs :D. Also depending on the time of day then there will be a lot of runs wit 0 events.

 

Thank you and I will look into the Iterative Macro learning.

estherb47
15 - Aurora
15 - Aurora


So the condition for the iterative macro to loop again would be if the count of records were 499. Anything else should halt execution of the macro.

 

Cheers!

Esther

Labels