How to run a REST API/Query for a grouping of items in the message, return as an array to map all the results together in a drop down

How to run a REST API/Query for a grouping of items in the message, return as an array to map all the results together in a drop down.

Hey everyone, really over my head but happy to search and read such a great community...

Basically, success I did API query and boy is it long. Wanting too pull from the response into a dropdown select the options to build a second call to filter the results.

From my searching and reading, I believe I need to do a js query, and write a script to return all the "sourceName" from my query.

Is this post the right idea? How to run a REST API/Query for each item in an array and return all results together

Here are some screenshots of my query and the copy paste of my work...

Screen Shot 2022-07-14 at 8.21.28 AM
Screen Shot 2022-07-14 at 8.21.41 AM

const arr = retention_source.data.message //your array of things to iterate over
const query = retention_source.data.message // your query to trigger for each

const promises = arr.map((item) => {
    return query.trigger({
      additionalScope: {
        sourceName: item
      }
   });
});

return Promise.all(promises)
const arr = retention_source.data.message.sourceName //your array of things to iterate over
const query = retention_source.data.message // your query to trigger for each

const promises = arr.message((item) => {
    return query.trigger({
      additionalScope: {
        sourceName: item
      }
   });
});

return Promise.all(promises)```

@mrockwell

Hey there, thanks for reaching out!

Just to make sure I am understanding your use case correctly:

1. You are looking to populate a select component with an array from this query.data. Are you running into any blockers in this step? In case this applies, I will share our docs on Data Conversion here.

2. You then would like to filter the results using this dropdown. Are you looking to filter through the query.data? If so, you should be able to run a query filtering these results on change. Here is an example where I run a Query JSON with SQL query to filter the results based on the select.value:

Let me know if I am misunderstanding your use case!