The iterative macro below pulls data down from Coupa's API until the payload back from Coupa is empty "= [] " I have tested this conditional outside of the macro and it works, but when I run in the macro it doesn't exit until the max iterations is hit. Attached the macro below.
* attached does have my api access token, but is just for the test site, and also for good measure I changed shortly after posting this (before someone tells me its bad practice to post that).
Would really appreciate a second set of eyes, thanks!
Hi @mathias149
What is the iteration parameter here? If i understood well you didnt set it up. The requested offset/range of records must increase between iterations.
Here i did something similar, using the page number = page number + 1 to iterate between pages of the SurveyGizmo API, if you want to check out:
It uses the [Engine.IterationNumber] variable to increase the offset in the API call. And it works, I am getting all the records I should be getting. The problem is the exit condition conditional is not stopping the loop when the data returned is empty (implying that I had reached the end of the records)
'https://nuskin-test.coupahost.com/api/contracts?fields=["id"]&offset='+tostring([Engine.IterationNumber]*50)
Ok, so if you replicate this idea it will work
1-When download data is null, [] or what it is after the last iteration, fiter it
2-Append this table with null rows (and sample = 1) to the next page parameter (so it wont exist)
@Felipe_Ribeir0 thanks sir. I'll give that a shot. I like to understand what I am doing wrong, can you help me understand why my approach didn't work, Still not quite understanding that bit.
@mathias149 Your iterations wont stop until you have this on your iteration loop.
It seems that your current workflow continue to provide the URL`s even after the last available data.