Use an AI query to cycling through rows in a table?


I have an AI query, which will generate text based on the cell of a selected row in my table, however - I wanted to know if there is a way to somehow cycle through all the rows in my table, and then give me the results as one text, but with a line between each one (at least for now, ultimately, in the end, I'd like to take the results from the AI response, and then write back to my table - but perhaps that's for another question....

My query is below. And it is triggered by clicking a button, with the response simply writing to a text box:

Draft a definition for this topic ({{tblMaterialityData.selectedRow.company_issue}}) in the context of the {{selectSector.selectedLabel}} sector. Keep the sentiment neutral and no more than 25 words. Don't make reference to the sector in the response

The result is displayed in a text box which has the default value of: {{}}

Any help appreciated, Neil

Hi @maillme It may be helpful to take a look at this doc which demonstrates how to loop through all records in a table and trigger a query for each row.

You'll end up with an array of all responses from getMaterialDefinition & you could transform that array with Javascript

1 Like

thanks Tess, ill look at that