locked
Color - Expression RRS feed

  • Question

  • User265788195 posted

    I ahve this on the Color Property of a cell..

    =IIF((Fields!SampleType.Value = "Fruit" & Fields!Quantity.Value > 25), "Red", "Black")

    But it doesn't work.. Not sure what am I missing...

    "SampleType" is one of the columns and "Quantity" is another column

    Is this because of the string comparision? { = "Fruit"} should be trimming that string somehow?

    Friday, March 1, 2013 11:59 AM

Answers

  • User281315223 posted

    It may be related to the & operator (which can be used as a logical "And" or can often refer to concatenation). You can try using replacing your '&' operator with "AND" to see if that makes any differences : 

    =IIF((Fields!SampleType.Value = "Fruit" And Fields!Quantity.Value > 25), "Red", "Black")

    My SRSS skills are a bit rusty, as I originally thought it was related to your '=' operator (which I thought should have been '=='). However after checking the documentation the '=' seems correct, but I think the 'AND' should work.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 1, 2013 12:51 PM

All replies

  • User281315223 posted

    It may be related to the & operator (which can be used as a logical "And" or can often refer to concatenation). You can try using replacing your '&' operator with "AND" to see if that makes any differences : 

    =IIF((Fields!SampleType.Value = "Fruit" And Fields!Quantity.Value > 25), "Red", "Black")

    My SRSS skills are a bit rusty, as I originally thought it was related to your '=' operator (which I thought should have been '=='). However after checking the documentation the '=' seems correct, but I think the 'AND' should work.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 1, 2013 12:51 PM
  • User265788195 posted

    That did work.. Thank you..

    BTW, do you know how I can combine both these conditions?

    =IIF((Fields!SampleType.Value = "Fruit" & Fields!Quantity.Value > 25), "Red", "Black")
    =IIF((Fields!SampleType.Value = "Bars" & Fields!Quantity.Value > 6), "Red", "Black")

    Friday, March 1, 2013 1:14 PM
  • User281315223 posted

    I answered this within the other thread related to this question.

    Friday, March 1, 2013 1:39 PM