You are experiencing this "issue" because Reporting Services evaluates both sides of the Iif
.
This is not really an issue, it is by design, see this technet article for more details:
Yes , By design the SSRS evaluates both True & False statements even
though the condition is not satisfied and through error if something
is not right.
Now, to get your expression working, you have to consider that Fields!month.Value
could be nothing even in the false part of your expression.
So in your expression, you could just replace
Fields!month.Value
by
Iif(IsNothing(Fields!month.Value), "1", Fields!month.Value)
Here is an expression with this fix:
=Iif(IsNothing(Fields!month.Value),"6mr",Left(Format(DateValue(MonthName(Right(Iif(IsNothing(Fields!month.Value), "1", Fields!month.Value), 2))
+ "," +
Left(Iif(IsNothing(Fields!month.Value), "1", Fields!month.Value),4)), "Y"),3) + " '" + Right(Format(DateValue(MonthName(Right(Iif(IsNothing(Fields!month.Value), "1", Fields!month.Value), 2))
+ "," +
Left(Iif(IsNothing(Fields!month.Value), "1", Fields!month.Value),4)), "Y"),2))
You could also create a custom function or use a variable if you want to reduce the expression length.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…