Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Loop through API calls until all data is downloaded/ Iterative Macro

SamZhong
7 - Meteor

Hi,

 

I'm using Alteryx to connect to azure devops odata using API. Since there's a page limit for each API call, I want to use a loop to call until all data is retrieved.

 

Here's a sample undone workflow, I haven't been able to figure out how to organize my macro.

 

I've circled the part where I want to do a loop: If after I call the API, there's a "$skiptoken" in the result, means there's a page break, I want to put the "$skiptoken:1234" after the original API end point (URL) and call the API again. If there isn't, then the data download is complete.

SamZhong_0-1580141991200.png

In the end I want to union all the data downloaded. 

 

I think I need to use Iterative Macro. I also have the macro I built attached, that doesn't work the way I want it to.

 

Could anyone let me know how to do this in the right way? Thank you!

5 REPLIES 5
fmvizcaino
17 - Castor
17 - Castor

Hi @SamZhong ,

 

The first thing you need to do in your macro is to change it to 'iterative macro' as image below.

fmvizcaino_1-1580143170968.png

After that, you need to configure your macro in the 'Interface Designer' tab found in Options tab.

fmvizcaino_2-1580143244835.png

After that, It is done! 

You only need to guarantee that your iterative output has the data needed to go back to your input and execute once again whatever you need.

 

Let me know if that make sense to you.

Best,

Fernando Vizcaino

SamZhong
7 - Meteor

Hi @fmvizcaino , thank you it worked and the macro ran!  Another followup question is - Now my workflow only save the output data from the last iteration. How can I append the results from each iteration all together? I know I'm supposed to use a union but I still haven't figure out how.

 

SamZhong_0-1580164365857.png

Pam
5 - Atom

I have the same problem! This post is so close to being the answer, but like so many others, it is incomplete. This must be a common activity using Alteryx, but the documentation is poor and the answers in the community are not intended to help someone new to Alteryx understand the process. 

 

I finally gave up and wrote it in C#!

SamZhong
7 - Meteor

@Pam , I actually figured it out after this post. The data output node will automatically append all the output data after each iteration, so put a select node after that would do the work. Hopefully this answers your question, although you've given up already lol.

Pam
5 - Atom

I'm glad you did!

 

I am still left with so many questions. How to iterate the URL, do I have to create them ahead of time or can I increment a variable, how does my workflow call the macro, how will it pass the data to the calling workflow. It just seems like there could be a comprehensive example somewhere, but I've been trying to piece it together for over a month!

Labels