I need to iterate through a Jira API response, however, I can't see how to do this. I looked at the transformers and didn't have any luck. I just started using Retool so any help would be great!
I access the data via the JiraTable query.
The end goal is to pull out the Jira keys and store them in a chart. If there's a better way to do this, that would be awesome.
Here's what the query looks like - {{JiraTable.data.issues['0'].fields.key}}
I need to iterate where the 0 is.
{{SPMAll.data.issues['0'].fields.key}} - JK-0
{{SPMAll.data.issues['1'].fields.key}}- JK-1
{{SPMAll.data.issues['2'].fields.key}} - JK-2
Apologies for the late reply! Thanks for that insight @Kabirdas, I'll go ahead and test it and see if it works.
Potentially yes this could be mapped to a table. Would that be a better route to take?
Appreciate the help and pointers!
Quick follow up, how do I account for pagination for the Jira adapter?
I've tried this query in a Javascript query but doesn't look like it's working........
let return_data = [];
let totalPages = 10;
let resultsPerPage = 100;
for (let page = 0; page < totalPages; page++) {
const response = SPMAll.trigger({ startAt: page * resultsPerPage, maxResults: resultsPerPage });
if (response && response.data && response.data.issues) {
return_data = return_data.concat(response.data.issues);
console.log(page);
console.log(response);
console.log(return_data);
} else {
console.log(Error: response for page ${page} is not valid);
}
}
When you're in a JavaScript query the values on components need to be set using specific methods, e.g. table2.setData(return_data) (the objects in the script itself are just copies from the model). I don't believe the Chart component has a similar function though. Instead, what you might want to do is reference the JS query itself in each component using {{}} the same way you would reference the original query.
Thanks @Kabirdas for your help. I think I found a different work around since I'm just wanting to pull the total results for each type, I created different queries for the different statuses and then pulled those values into an array and then from there put those in a chart. Not exactly the ideal solution but it works for now.