This is a strange problem...
The button is inside an expanded area in a table, so there is an array of buttons with index i matching the table row index.
The Click event handler is set to run a Script. The idea is to choose between an "Add" query or and "Update" query depending on whether a value in that row exists (a booking reference) or is still null.
In the snapshot we can see the table22.data is available, with several rows, indexed 0, 1, 2, 3, 4 etc.
If I click on the row object, the keys and values are clearly visible and available, including the one reference in the script (Item_booking_Id).
But when the script runs the Debug console shows this...
The number it mentions is always the index of the row and button concerned.
It makes no difference which key follows the data[i]. , even with no key, ie (table22.data[i]) it still gives the same error.
Changing "i" to a number, eg table22.data[3] cases the same error and the number itself is mention in the error message..
"Error:Cannot read properties of undefined (reading '3')"
Why can't the script access the row data in the table?
UPDATE:
I tried using the same indexing into data in the "Only run when" section, and that works fine. So now the click handler looks like this...
Within the expanded area you can use currentSourceRow.Item_booking_Id. This will refer to the source data of the row within which the button is nested.
It's just that it's one of those time-wasting traps that we can get stuck in when something looks like it should work but doesn't. table22.data[i] seems like a perfectly reasonable object to use, but mysteriously fails in the click handler script.
By the way, if you know of any difference between currentRow and currentSourceRow then please let us know. To me, so far, they seem to be the same thing.
So I think, and I may be wrong here, that components inside an expandable row can only refer to currentRow and currentSourceRow, they can't refer any components outside of that (pretty much like repeatables would behave). So in your case, table22 will be undefined as the button is not able to access it.
With regards to currentRow and currentSourceRow:
currentRow will show the table's data as displayed and configured, i.e. any deleted columns won't be available, and any columns using mapped value will return the mapped value, e.g. if you have a string column with _.capitalize in mapped value, instead of hello you wil get Hello when using currentRow.
The logic follows that currentSourceRow will return the raw data as per the table's data source, regardless of any manipulation you've done with columns, and within a column's mapped value.