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):
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:
@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.
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, 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.