Hi all, new to the forum so apologies if this is not the correct place for this post.
I'm attempting to create a table in Retool that I can use to get/update a database in Notion. Now, I've spent some time looking through the Notion API documentation, and have a POST written to query the database and get the details of the pages within the database (each item within the database is a page, and each page has a list of properties, which is what I'm after).
The results of the query is a data object, which has a results array of page objects. Each page object has a properties object (properties are consistent from page to page, so each page object has the same properties object), which contains objects for each property. Each property object has subobjects, which eventually lead to strings, which is what I want to display in the table for each page.
For example, every page in my Notion database has a Name property (which is the name of the page). If I wanted to retrieve the name of the first page I could write a sql query to:
SELECT {{queryName.data.results['0']. properties.Name.title['0'].plain_text}}.
The problem is that this only gives me the name for one page, and I'd like to have a column which the name of each page. If I write a query to select * from data.results I get a column with the page ID, some other unimportant information about each page, and then a properties column, which has all of the properties nested within it. I'd like to select the nested string from each of these properties objects and have them each as separate columns, where the column name is the property object name.
I can do this easily enough with custom columns in the table which grab that information for the currentRow, but can't figure out how to do this with the query itself. The reason I want this in the query is twofold:
A. I'd like to be able to query the data in that table, and can't query calculated Column data
B. I'd like this to be a read/write table, which updates the Notion database, and can't think of how to do this without making sure the query returns the correct values, so that the update takes place for the correct object when sending the data (the terminology I used here may be wrong, I am still learning)
I hope that this was enough detail to explain my goal here, still learning how to do all of this, so please bear with me.