Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Loop download API, sets of 10

JarkkoP
7 - Meteor

HI,

 

I'm trying to create a looping Macro to download API data from an list of API addresses. The interface accepts a set of 10 nodes at the time so I would like to convert the data to set of 10 nodes. Does anyone have a good idea how to do this? 

 

Datatable is in the following format: 

 

https://google.com/1https://google.com/1
https://google.com/2https://google.com/2
https://google.com/3https://google.com/3
https://google.com/4https://google.com/4
https://google.com/5https://google.com/5
https://google.com/6https://google.com/6
https://google.com/7https://google.com/7
https://google.com/8https://google.com/8
https://google.com/9https://google.com/9
https://google.com/10https://google.com/10
https://google.com/11https://google.com/11
https://google.com/12https://google.com/12
https://google.com/13https://google.com/13
https://google.com/14https://google.com/14
https://google.com/15https://google.com/15
https://google.com/16https://google.com/16
https://google.com/17https://google.com/17
https://google.com/18https://google.com/18
https://google.com/19https://google.com/19
https://google.com/20https://google.com/20
https://google.com/21https://google.com/21
https://google.com/22https://google.com/22
https://google.com/23https://google.com/23
https://google.com/24https://google.com/24
https://google.com/25https://google.com/25
https://google.com/26https://google.com/26

 

And it should be translated into the following (API request URL): 

 

 https://google.com/1, 2, 3, 4 5, 6, 7, 8, 9, 10
 https://google.com/11,12,13,14,15,16,17,18,19,20
 https://google.com/21,22,23,24,25,26

 

Second question is how to convert it into a looping macroto pull the data out in one go? I tested the iterative Macro, but for some reason, I could not get it to work 😞

 

Thanks!! 😃

 

 

9 REPLIES 9
atcodedog05
22 - Nova
22 - Nova

Hi @JarkkoP 

 

You can pass all the URLs in one go in the download tool it process URL in each row hence you should be getting data for all 3 requests.

 

Hope this helps : )

Thableaus
17 - Castor
17 - Castor

Hi @JarkkoP 

 

You don't need an iterative macro. The Download tool can take care of one call per row for you.

 

Here's a way to do it.

 

Thableaus_0-1643112414361.png

 

You can generate rows to create as many calls you want (in this case, 26). Then you can split in tiles of 10 by using the Mod Function and the Multi-Row Formula. 

It's a matter of concatenating them using the summarizing tool and grouping by tile. Just send that to the download tool and it will be fine.


Cheers,

JarkkoP
7 - Meteor

HI Thabelaus! Thanks for the quick response! My example was a bit bad, apologies for that.  the number of nodes can change on every request, and the numbers are not in the form of1-26. the node IDs can be anything from 14673 to 95765, totally random numbers. 

JarkkoP
7 - Meteor

This helps, thanks atcodedog! I didnt realise I can pass them as seperate URLs to the download tool. Only thing im still struggling is how to divide them to sets of 10. 

Thableaus
17 - Castor
17 - Castor

@JarkkoP 

 

Use the example I just showed. It's a matter of adding a RecordID (instead of generate rows) and using the MultiRow  Formula with the Mod Function to split in the appropriate buckets of 10.

 

Cheers,

 

 

JarkkoP
7 - Meteor

I did, but its not working correctly. Whenever I have more data in the source, its messing the results 😞

 Thanks!

JarkkoP_0-1643114158477.png

JarkkoP_1-1643114179582.png

 

 

Thableaus
17 - Castor
17 - Castor

In this case you should add a RecordID and use the RecordID as the field to create the tiles with the MultiRowFormula tool.

 

Add a Record ID after the Generate Rows tool. Only use that Record ID to create the tiles, the Field you concatenate should be your "Field2" as you're doing now.

JarkkoP
7 - Meteor

I was a bit slow on understanding that one ;=) It's working now! :=)

 

Thanks a lot!

Thableaus
17 - Castor
17 - Castor

Something like this attached.

Labels