Need row variable to be formed as a result of user input or as a result of an expression

Need row variable to be formed as a result of user input or as a result of an expression

Hi,

I have a form and am using a for each record statement which gets assigned to getroomstatus

in my form i then need to check each column in a row for a value, the column is selected by user input

I can use if getroomstatus.column1 == free , if getroomstatus.column2 == free etc etc
This works ok but i have have 50 columns to check

better would be to make getroomstatus.column1 as a result of user input

I tried whichcolumn=getroomstatus+input.roomslected but this does not work

also tried

whichcolumn="getroomstatus."+input.roomselected also did not work

Any suggestions or guides on how to work with row variables

Thanks