UI Tricks for Buttons: Dynamic Buttons & Actions

As an intellectual exercise, Ive tried a few permutations of this including:

if({{table1.selectedRow.index}}== undefined){
  return {{textInput2.value}}
} else {
  return {{table1.selectedRow.data.samplevideo}}
}

tried hardcoding the first index in:

if({{table1.selectedRow.index}}== undefined){
  return {{textInput2.value}}
} else {
  return {{table1.selectedRow[0].data.samplevideo}}
}

And the transformer function is still returning either 'undefined' or 'null'

Edit: ok, I did a little additional debugging (just return selectedRow to see what that was outputting and confirmed it was outputting a selectedRow obj to begin with) and after confirming the obj schema was expected, I tried again simply writing:

if({{table1.selectedRow.index}}== undefined){
  return {{textInput2.value}}
} else {
  return {{table1.selectedRow.data.samplevideo}}
}

which is one of the permutations I had attempted earlier that had been returning null or defined. so I am not really sure why that was the case, but it seems to be working now?

That being said, I would still like to figure out a more direct approach with the eventHandlers but that may just be a separate thing at this point