Table Drop Down Value

I have a table that has update functionality through a SQL query.

I have provided a dropdown with allowed values.

Although when referencing the selected value in the dropdown {{ }} I have a null value.

How do I fix this?

I think that's because refers only to the original value of that table cell (which in your example is null), rather than any unsaved changes you've made to it.

If you look at update_bet_reasons.recordUpdates you should find an array that reflects unsaved changes made to those bet_reason (or any other) values.

When we've made editable tables, we've used a "Bulk update via a primary key" query with the full table.recordsUpdate array, rather than defining individual key/value pairs.

More on that here

One of our editable tables' bulk update queries:

Of course many things in Retool have multiple, equally valid approaches to the same result, so YMMV!

Thanks for the respone!

That method is great for your use case, but I am trying to have one value updated that will update many in the db, I don't have the luxury of just updating by id so how would I go about getting that particular value for the row that has changed?

Poke around in the State browser (left editor panel) while you manipulate the values in your table, and watch what changes… you will likely find something in update_bet_reasons.recordUpdates or update_bet_reasons.changeSet that you can use.

If you're specifically watching the row that is currently selected to grab the changed value, perhaps something like update_bet_reasons.changeSet[update_bet_reasons.selectedRow.index].bet_reason, however that seems potentially risky, because if the value is updated in a row then a different row is selected for any reason, you lose access to the changed value.

I'm a new developer and only been using Retool a few months, so proceed with any ideas from me with caution.