locked
SSRS Expression RRS feed

  • Question

  • User-1330916695 posted

    Can someone please validate this. I am getting errors and dont know why. 

    =IIF((First(Fields!WorkGroup.Value, "WorkLabels") = "FLEET"), "TRIANGLE",
    IIF(Left(First(Fields!WorkArea.Value, "WorkLabels"),1) = "1", "HEART"),
    IIF(Left(First(Fields!WorkArea.Value, "WorkLabels"),1) = "2", "CIRLCE"),
    IIF(Left(First(Fields!WorkArea.Value, "WorkLabels"),1) = "4", "SQUARE")
    ))

    Tuesday, February 2, 2016 6:33 PM

Answers

  • User475983607 posted

    The last IIF is missing the false value you have () open close issues.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 2, 2016 6:49 PM
  • User-986267747 posted

    Hi scstevelong,

    =IIF((First(Fields!WorkGroup.Value, "WorkLabels") = "FLEET"), "TRIANGLE",
    IIF(Left(First(Fields!WorkArea.Value, "WorkLabels"),1) = "1", "HEART"),
    IIF(Left(First(Fields!WorkArea.Value, "WorkLabels"),1) = "2", "CIRLCE"),
    IIF(Left(First(Fields!WorkArea.Value, "WorkLabels"),1) = "4", "SQUARE")
    ))

    According to your code, i suspect that you don't know how to use the IIF function, it returns one of two objects, depending on the evaluation of an expression. You could refer to the following link to learn how to use it , then you could modify your code and make it right.

    https://msdn.microsoft.com/en-us/library/27ydhh0d(v=vs.90).aspx

    Best Regards,

    Klein zhang

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 3, 2016 4:54 AM

All replies

  • User475983607 posted

    The last IIF is missing the false value you have () open close issues.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 2, 2016 6:49 PM
  • User-986267747 posted

    Hi scstevelong,

    =IIF((First(Fields!WorkGroup.Value, "WorkLabels") = "FLEET"), "TRIANGLE",
    IIF(Left(First(Fields!WorkArea.Value, "WorkLabels"),1) = "1", "HEART"),
    IIF(Left(First(Fields!WorkArea.Value, "WorkLabels"),1) = "2", "CIRLCE"),
    IIF(Left(First(Fields!WorkArea.Value, "WorkLabels"),1) = "4", "SQUARE")
    ))

    According to your code, i suspect that you don't know how to use the IIF function, it returns one of two objects, depending on the evaluation of an expression. You could refer to the following link to learn how to use it , then you could modify your code and make it right.

    https://msdn.microsoft.com/en-us/library/27ydhh0d(v=vs.90).aspx

    Best Regards,

    Klein zhang

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 3, 2016 4:54 AM