Dynamic Picklist based on radio button selection

Dynamic Picklist based on radio button selection

I can't get the following code to work.
  1.    if (count(Surface[Type == "Film"])  ==  0)
        {
            clear Top_Surface;
        }
        else
        {
            film  =  Surface  [Type == "Film"] sort by  Type ;
            Top_Surface:ui.add(film.Film_Tafetta.getall());
        }
It seems if i change the above code to the below code, i do not get an error but i have another problem instead.
  1.  if (count(Surface[Type == input.Membrane_Configuration])  ==  0)
  2.     {
  3.         clear Top_Surface;
  4.     }
  5.     else
  6.     {
  7.         film  =  Surface  [Type = input.Membrane_Configuration] sort by  Type ;
  8.         Top_Surface:ui.add(film.Film_Tafetta.getall());
  9.     }
The input. Membrane_Configuration values do not match with the Field Type in the Form Surface. This causes no values to appear in the drop down    Top_Surface .

I need to have this code look up based on the value "Film" NOT the input value of the radio button.  

I already have an if statement based on the value selected in the radio button and depending on what is selected the code will change "Film" to something else for other criteria.

How can i solve this?

Thanks
Matt