Split function syntax causing problem in Switch statement

  • Hello,

    The following Switch statement works fine in my report:

    =Switch

    (

    Fields!AnswerOptionType.Value="Checkbox", "Checkbox test",

    Fields!AnserOptionType.Value="Radiobutton", Split(Fields!AnswerOptions.Value,"||").GetValue(0),

    True,""

    )

    I need to be able to dynamically set the index of the item in the array, though (not hardcode it to zero). When I use the expression

    =Fields!AnswerOptionType.Value="Radiobutton", Split(Fields!AnswerOptions.Value,"||").GetValue(CInt(Fields!SelectedValues.Value))

    by itself and outside of the Switch statement, it works well.

    When I use it in the Switch statement, though, as shown below, the first condition produces an error. It's clear that it doesn't like the "CInt(Fields!SelectedValues.Value)". I've tried adding parentheses in different places and moving the order in which the expressions are evaluated but nothing seems to work.

    =Switch

    (

    Fields!AnswerOptionType.Value="Checkbox", "Checkbox test",

    Fields!AnserOptionType.Value="Radiobutton", Split(Fields!AnswerOptions.Value,"||").GetValue(CInt(Fields!SelectedValues.Value)),

    True,""

    )

    Thanks for your help!

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply