Search code examples
teleriktelerik-reporting

Telerik textbox value expression IIF formatting


In Telerik Reporting, im using the condition for a textbox value expression

=Iif(Parameters.UnitType.Value == "some string", some_value1, some_value2)

And this is giving an error. not valid: Syntax error: Missing operand before '=' operator

Kindly let me know where i am going wrong.


Solution

  • The problem lies interestingly in HOW the Iif works. It does not work like a C# if statement but more akin to a VB if statement. Thus the problem stems from the == itself. The Iif statement in telerik reports expects a single = instead of a == that is the reason why you get the error message when you use a == to compare the values.

    Thus if instead of:

    =Iif(Parameters.UnitType.Value == "some string", some_value1, some_value2)
    

    You use:

    =Iif(Parameters.UnitType.Value = "some string", some_value1, some_value2)
    

    The statement should work.