Help Needed: ListBox Not Displaying Data from Airtable Query

Hello Retool Community,

I'm encountering an issue with a ListBox component in Retool and seeking assistance. Here's a detailed description of the situation:

Objective: I'm trying to populate a ListBox with data from an Airtable table. I have a query named GET-AcaYear set up to fetch data from a table named 'AcaYears'. This query is functioning correctly and returns the expected data in JSON format. The data structure is as follows:

{
"data": {
"records": [
{"id": "rec1KqbARCqSruT83", "fields": {"AcaYear": "2020-21"}},
{"id": "rec1xMViemyLjrDBH", "fields": {"AcaYear": "2022-23"}},
// ... more records ...
]
}
}

Issue: When I try to configure the ListBox to use this query's data, I'm running into problems. Using the expression {{ GET-AcaYear.data.records.map(record => record.fields.AcaYear) }} in the data source field of the ListBox, I'm encountering a 'Reference error: GET is not defined.' If I modify the expression to remove the curly braces, the error changes to 'Value given is empty.'

Attempts to Resolve:

  • I've verified that the query name is correct and that it executes successfully.
  • I've tried using optional chaining (e.g., ?.) in the expression, but it doesn't resolve the issue.
  • I've considered mapping the query results to a temporary state, but I'm unsure how to implement this effectively.

I would appreciate any insights or suggestions on how to resolve this issue. Could there be a syntax error in my expression, or is there a specific way to configure the ListBox to accept dynamic data from a query?

Thank you in advance for your help!