Alteryx Designer Desktop Discussions

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

Construct URL with 2 variables until condition met

brwright
8 - Asteroid

I have a table of four folder IDs that are constructed into a url. 
The URL also takes an offset parameter and maximum of 100 records are returned each call.

example: 

"https://genericurl.com/folders/"+[folderId]+"/assets?sortby=datemodified&sortdir=desc&limit=100&offset="+[offset]

I have the 4 folder iDs and I put them in as text input. Then the offset will need to iterate by 100 until say 19000 records are put in a spreadsheet. 

 

Then move to the next folderid which will have its own total number of assets to offset by 100 until reached. 

I also need the spreadsheet to append.

This is a sort of nested loop. I need macro help to accomplish this. 

 

Thanks in advance!

6 REPLIES 6
IraWatt
17 - Castor
17 - Castor

Hey @brwright,

Sounds like you need a batch macro which will loop through the 4 folder ID's. Then contained in the batch macro you will have an iterative macro which loops 100 times and has a data output tool set to append to the existing sheet.

There is some great videos on the community on batch macros here if you want to do some research on how this is made:

https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons/label-name/Macros  

Hi @brwright , I'm not sure I totally understand the scenario but check out the attached. I just used a generate rows tool to create new rows for each folder id with the offset increasing by 100 until 19000 is reached.

IraWatt
17 - Castor
17 - Castor

@brwright I agree with @michelle_mathews approach although I don't think you would be able to stop once the spreadsheet reached 19000 records that way, It would only stop once all the requests were made. The macro way you could add add a check for 19000 records in the file. 

brwright
8 - Asteroid

Thanks @michelle_mathews I was able to use the numassets value to build the rows

folderidnumassetsoffset
243029590
2676471301380
10067754193640
8936129144600
brwright
8 - Asteroid

 I now have 638 rows of URLS I thought the download tool would read each and the workflow would update the output file 100 rows at a time. Im thinking I have to pass the URL  through a macro.  Trying to figure that part out now.

brwright
8 - Asteroid

🤔

Labels