Dropdown produces 'no data' when adding record into an empty table

I have a table based on a postgresql query.

If the table query returns no records (ie, the table is empty), and I try to add a new record to the table, the fields set as dropdown types return 'no data' when trying to make a selection:

If however, the table query contains at least one row of data, and I try to add a new record/row, the dropdown fields do show data to select from based on their value list (as expected):

Note: behaviour is the same if the dropdown fields have a static list or a query as their value list.

Hey @gsanders - what the expected behavior here, you’d like to be able to add a row even when the query returns no results?

Meanwhile, could you send over a screenshot for the settings for the dropdown column so I can see the values and labels?

Hi Justin - yes thats right - if the query returns no results, would like to create a newRow entry by adding a record, and then write that newRow entry back to a database table using a write resource.

Here is the current setting for the contract_type field:

But I have also tried entering values as a static list:

No difference.

@gsanders gotcha, makes sense. So my first hunch would have been that if you’re powering the dropdown dynamically with values from your query, if the query isn’t returning any data then your dropdown won’t either. For your hardcoding screenshot - did you also hardcode values for labels? If not can you try doing that too?

Just harcoded the static list into the labels as well as the values - and no difference - still ‘no data’ when the table is empty.

Worth noting too: the query for the dropdown values and labels is a different query than the one used to populate the table, so it does seem as though the problem is related to the table being empty and not anything particularly to do with the source of values or labels for the dropdown.

@gsanders gotcha. I was indeed able to reproduce this on my end - I’ll bring this up to the engineering team and update you when it’s fixed!

1 Like

@justin, any update on this? or any hints for a workaround?

Hey @gsanders! Unfortunately we haven’t been able to prioritize this yet - will update the thread when it’s fixed.

@Justin Any update on this?

It makes dropdown fields on table add views completely unusable unless when there’s no data in the main table. This has got to be a really common use case for a table! The fact that it’s been an issue for 6 months gives me concerns about sticking with retool…

Did anyone find a workaround better than resorting to making separate add forms?


Hey @danperry! Apologies for the delay on getting this fixed, there are a lot of open bugs that need our attention :confused:

Let me try and see if I can get this prioritized this week, stand by

Thanks Justin

@danperry we’ve figured out the issue, but don’t have a fix out yet - someone is working on it!

@justin any update on this? I’m about to start creating ‘add’ forms for all my tables… but will hold off if it’s going to be resolved anytime soon

@danperry just checking in w/ engineering, stand by

Hey @danperry, I’m Emily, an engineer here at Retool picking this up! Sorry for the delay on this. We’ve got a fix in review now, I’ll post here when it’s live.

Hello @danperry, this should be fixed now. If you reference query results {{ query1.data }}, or values like {{ [1,2,3] }}, they should show up for an empty row! If you reference currentRow or i, those values will not be able to be rendered since we don’t have a currentRow or i for the new row.

Let us know if you have any questions!


@emily @justin

I have a simple state dropdown as such:

It seems like a separate issue for me, but my pre-defined dropdown options do not show up whether there is or there are not any rows in the table.

Please advise.

EDIT: Resolved. Needed to remove the semicolon at the end of the values array despite the field validation passing

@glibt was just going to say that :slight_smile:

Perfectly same matter happens again in retool cloud as of 2022/5/25 or self-hosted retool : 2.89.11(latest) .

I have solved this issue by myself.

if a query doesn't have no return record, table data should be set as "query.dataArray" like below.

But I can't find the query parameter to judge whether there are some return record, so that I use a primary key column of my custom table.


1 Like