Expressions do not work that way.Upon initial evaluate of your statement, Archicad checks if all the variables are valid for the element being evaluated. If any are invalid for that element the whole expression is marked invalid.
Since your two parameters are valid only for their particular type, one or the other will always be invalid.,thus the whole expression.
In this case, you do not even need a if statement. Just make two sequences using the ADD button. Each with just the parameter name. Archicad will then pick the correct one