How to extract the value of the selected row

I wrote a helper function for that.