Fill a dropdown based in conditions and others dropdown in others forms

Fill a dropdown based in conditions and others dropdown in others forms

I have to generate a complex choice based in an initial selection.
I have Universities (A), Years (B), Matters (C), Teachers (D), Lesson titles (E).
In the first step people select A, so I have a script to populate B. Then people select B and another scritp populate C, and so... as soon as E.
Now I have to add another variable condition, that is type of course (complete or partial (X), so when people select B  may  also select X, and I need to populate C based on two variables, B&X. I try to rich my script with other variable, but don't run:

if (count(formname[B == input.B])  ==  0)
{
        if (count(formname[X == input.X])  ==  0)
        {
    clear C;
}
else
{
    Clist  =  formname  [(B== input.B) && (B== input.B)] sort by  C ;
    C:ui.add(Clist.C.getall());

}

Any help?

Mic