Issues with SWITCH

  • Hi everyone

    I have the following SWITCH function in my report:

    =Switch(Fields!Result.Value >=92, "Green", Fields!Result.Value >=82 <92, "Yellow", Fields!Result.Value <82, "Red")

    I've noticed that in most cases it works ok but sometimes (when the result is 0 or 100 for example) the function does not give the desired result.

    Any ideas what the problem might be - could it be an integer issue?

    Thanks in advance.

    BO

  • ByronOne (3/6/2012)


    Hi everyone

    I have the following SWITCH function in my report:

    =Switch(Fields!Result.Value >=92, "Green", Fields!Result.Value >=82 <92, "Yellow", Fields!Result.Value <82, "Red")

    I've noticed that in most cases it works ok but sometimes (when the result is 0 or 100 for example) the function does not give the desired result.

    Any ideas what the problem might be - could it be an integer issue?

    Thanks in advance.

    BO

    A switch will return the given value for the first true expression. Your second expression should only be Fields!Result.Value >= 82. The <92 is unnecessary because anything 92 or greater would have been true in the first condition and the statement would have returned the first value. I don't know that this is the cause of your problem, but it couldn't hurt to clean up the statement.

  • Daniel

    That was the problem.

    Thanks for your help - much appreciated!

    BO

Viewing 3 posts - 1 through 2 (of 2 total)

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