Action Button Doesn't Select Row

I have a table with an action set to insert a new record based on the row's data.
However, when clicking the action button, the row is not selected so the query is getting its data from the selected row, not the "actioned" row.
I have this setup in the quantity field of the query in order to get the value of the editable cell before submitting. I presumed this would get the edited value if it was edited, or the original value if not. The primary key on the new table is set to the variant_id.

{{ table1.changesetObject && table1.changesetObject[table1.selectedRow.variant_id] && table1.changesetObject[table1.selectedRow.variant_id].quantity_ordered !== null ? table1.changesetObject[table1.selectedRow.variant_id].quantity_ordered : table1.selectedRow.quantity_ordered }}

I've spent so many hours trying to figure this out and seem to keep finding new ways for this to fail. Any tips greatly appreciated!

Hello @jason3w

For the table actions, you can try to make use of currentRow instead of selectedRow.

You can see row 3 is highlighted while action button on row 1 is clicked, the currentRow is giving data for row 1.

Hi Lenti,
Thanks again for replying.
Seems like {{table1.currentRow}} is not available within the query itself, so I've done as you've show here and set the state first, then use that in the query.
Seems like a roundabout way to do it and I feel like I'm missing something, but at least it's working now.