
Announcements
So I have a REST API (Jira in this case) and I'm retrieving quite a large number of records. The API only allows a maximum of 100 records to be retrieved at any one time.
The API does return the total amount of records on the first call. So let's say I had 284 records to retrieve and store in a Collection. At the moment I am doing it in a very hacky way like this and ending up with all records in a collection called jiraRawData, but there more be a more robust way to deal with any amount of records.
What's the best way to do this seeing as PowerApps doesn't have a proper loop construct ? Thanks.
ClearCollect(
jiraRawData1,
JIRACloudAPI.GetIssuesForJQLQuery(
{
jql: "project = MYPROJECT AND issuetype in (standardIssueTypes(), subTaskIssueTypes(), Bug, Epic, Feedback, Spike, Story, Task, Bug-Subtask, Sub-task) AND fixVersion in (10.14.0, 11.0.0, 11.1.0) ORDER BY created DESC",
startAt: 0,
maxResults: 100
}
).issues
);
ClearCollect(
jiraRawData2,
jiraRawData1,
JIRACloudAPI.GetIssuesForJQLQuery(
{
jql: "project = MYPROJECT AND issuetype in (standardIssueTypes(), subTaskIssueTypes(), Bug, Epic, Feedback, Spike, Story, Task, Bug-Subtask, Sub-task) AND fixVersion in (10.14.0, 11.0.0, 11.1.0) ORDER BY created DESC",
startAt: 100,
maxResults: 100
}
).issues
);
ClearCollect(
jiraRawData,
jiraRawData2,
JIRACloudAPI.GetIssuesForJQLQuery(
{
jql: "project = MYPROJECT AND issuetype in (standardIssueTypes(), subTaskIssueTypes(), Bug, Epic, Feedback, Spike, Story, Task, Bug-Subtask, Sub-task) AND fixVersion in (10.14.0, 11.0.0, 11.1.0) ORDER BY created DESC",
startAt: 200,
maxResults: 100
}
).issues
);
Hi @slong ,
According to your description, I think the forall() function and the collect() function can meet your needs.
I did a test for you.
1\ I assume you have 284 records to retrieve.
So you need to loop 3 times.
2\ You could try the following formula:
ClearCollect(Thevar,0); ForAll(Sequence(3),Collect(jiraRawData,
ClearCollect(jiraRawData1,JIRACloudAPI.GetIssuesForJQLQuery({jql: "project = MYPROJECT AND issuetype in (standardIssueTypes(), subTaskIssueTypes(), Bug, Epic, Feedback, Spike, Story, Task, Bug-Subtask, Sub-task) AND fixVersion in (10.14.0, 11.0.0, 11.1.0) ORDER BY created DESC",startAt: Last(Thevar).Value,maxResults: 100}).issues)) ; Collect(Thevar,Last(Thevar).Value+100)
)
Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.