Alteryx Designer Desktop Discussions

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

Break Iterative Macro loop

AmruthaPydeti
8 - Asteroid

I have a Rest API with pagination. I get the output as XML. I am parsing l. And the data might increase every 2 weeks. So I don'w know how many pages it may grow or reduce. Each page will have only 50 records. I am using Iterative Macro to implement pagination. I have set my iterations to 50. Currently, after 30 page iterations  there is no data. So the XML parse is failing since there is no new records of XML to parse. how do I break the loop if there is no data. Currently i set the iterations to 50. That way even if it increases it could pull all the data.

6 REPLIES 6
BrandonB
Alteryx
Alteryx

You probably want your XML parsing after the filter tool that specifies the iteration criteria. That way if the value is null it will exit out rather than trying to always parse the XML regardless of its existence. 

BrandonB
Alteryx
Alteryx

iteration.png

AmruthaPydeti
8 - Asteroid

I have a download tool followed by XML Parse tool. The output of Download tool give me an XML and outer XML. Then I am parsing the Outer XML. It says "Record_OuterXML" is not contained in the record.

 

BrandonB
Alteryx
Alteryx

You could take a placeholder approach like this where you union Record_OuterXML followed by a !IsNull([Record_OuterXML])

 

That way there will always be a column even if the Outer XML is not returned. I'm not sure what you are ultimately passing out as data, but hopefully this points you in the right direction. 

 

 

placeholder.png

AmruthaPydeti
8 - Asteroid

When the XML is parsed I would get new columns. IF I just put the placeholder the columns that are generated after the parsing will still be missing and it will fail.

AmruthaPydeti
8 - Asteroid

I realized that I can check on row count. Add filter to check number of rows is equal to 50 then pass the next iteration values otherwise it will stop the iteration. if the values for next iteration are empty.

Labels