Formatting SQL results for Dynamic Default Value

I feel like I am close to something here, but I just can't get there on my own...I am hoping the Retool community may be able to assist.

I am making an app with two functions. Allow users to add data into a Retool Database, and allow users to edit those records later.

When they enter data, several fields use checkbox groups to allow multiple rows to be added to the database at once. When they modify records, I would like to use the same checkbox groups, but set the default value to whatever is already in the system for that entry. In the below picture, you will see that I set the default value to a static array to show what I would like the result to be.

In order to try and make it dynamic, I created a query which outputs the same three numbers I used in the test, and then used:
({{ formatDataAsArray(query71.data)}})
in the default value, but as you can see, it doesn't seem to pull the numbers in. I am guessing that I am not using the correct formatting, but I just can't seem to figure out how to put the SQL results into a format that the "Default Value" field can read.

I would be extremely grateful for any guidance.

Thank you!

Hope this helps

the query16 SQL is as below
Select
id,name
from
"paymentA"
where
id in (1, 2, 3)
order by
id asc

import this json file for another example:
test1.json (12.7 KB)

1 Like

Figured this out... I was overcoding.

{{FindBasicTypes.data.type_id}} worked just fine.