Mattias
Mattias

Reputation: 70

Logic App Until action, how to set count dynamically?

I have a logic app that is fetching data from an API endpoint. The API is using pagination and has an limit of 50 objects per request and then provides an link for the next 50 objects until it gets all the objects, however I have no idea on how many objects there will be for each request. My flow is briefly described down below:

The issue with the until loop is that you can set limits for count and timeout as you can see here. As I have no clue on how many pagination there will be I am expecting this loop to run until the condition specified is met. However, I have tried specify some different values listed below:

I have researched on how many pagination this specific request has and it turns out it has 290 paginations. My expectations is that this until loop will run until nextLink is equal to null which will be after 290 loops. But I wonder if there is any possibiliy to specify a dynamic value for Count in the until action?

I am expecting the UNTIL action to run as many time as needed based on how many pagination there is, that is atleast what I suppose it should do because if I need to specify a value for how many times it needs to run then this action is pretty useless. Hopefully there is someone in here that maybe have faced the same issue.

Best regards

Upvotes: 0

Views: 2772

Answers (1)

Hury Shen
Hury Shen

Reputation: 15754

As far as I know, "Until" action requires us to define at least one limit to prevent endless loops. enter image description here

For your problem, you can just define a count which is large enough to allow your endpoints show all of the pages. If you want to specify a dynamic value for the count, you need to meet two conditions:

  1. You have to be able to access total number of pages (if your endpoint provides a url to get it).

  2. The count set in "Until" action can only reference trigger inputs, trigger outputs and parameters.

According to the statement in your question, I guess you can't meet these two conditions. So I think we can just set a count which is large enough.

Upvotes: 0

Related Questions