So here is the situation
I call an API which has thousands of results, in the API call I filter by date range to get me down to maybe 300 results, the amount can vary from only 1 result to whatever depending on the user input of the date range.
The API provider has a max limit to only return 100 results at a time.
So far my solution has been to split the date range using datediff into each day, so a user inputs a date range of 1 Feb to 28 Feb and it counts 28 days.
I use that as a repeat expression and and run the API get inside the repeat, and it fetches all the results one day at a time, so far so good, this is working well, however I am getting many duplicate results because of the type of data I am fetching.
In other words, this is a booking API, a person could book a holiday spanning 5 days, and book an activity per day, meaning that my repeat is pulling their booking on day 1, 2, 3, 4, and 5.
The repeat structure looks like this
repeat[0]api.data.bookings [0],[1],[2],[3] /*day 1 - 4 bookings*/
repeat[1]api.data.bookings [0],[1],[2] /*day 2 - 3 bookings*/
By using multiple flatten formatters inside a SetValue step outside the repeat I have managed to get this merged to a degree, with the idea of finally getting to a structure that I can return a single unique collection, something like
my_set_value_name [0],[1],[2],[3],[4],[5],[6] /*day 1 & 2 - 7 bookings*/
So far I have got down to
repeat.flatten('api').flatten('data').flatten('bookings')
So just need to make a single list from 0 - infinity, instead of this grouping.
Anyone got any ideas.
Last updated: