I had created a UltraGrid that had a hidden field that holds a rowid value. I was having a problem of converting the string value I was getting from the cell back to a rowid value. What I found was that I had to trim the returned string value before converting it to a rowid. See the code sample below.
assign
cRecordRowid = ultraGrid1:ActiveRow:cells:Item:value
rwRecord = TO-ROWID(TRIM(cRecordRowid)).
MESSAGE cFrameClass cRecordRowid STRING(rwRecord) VIEW-AS ALERT-BOX.
Instead you might try the value of pbs:InputValue.
Or rely on the fact, that the query, the binding source is using as it's datasource, is positioned to the right record. In case of a dataset that's the TOP-NAV-QUERY.