Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Services / Reporting Services / May 2006

Tip: Looking for answers? Try searching our database.

problem with IIF statement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mathias - 25 May 2006 20:48 GMT
I've got this iif statement

=iif(Fields!Month.Value =13,"YTD",MonthName(Fields!Month.Value))

in a matrix header field that has the month numbers in it.  it will
display ytd if i drop the month name function but with the monthname in
it throws an error.  Also theres a warning that says

[rsRuntimeErrorInExpression] The Value expression for the textbox
'textbox47' contains an error: Argument 'Month' is not a valid
value.

any ideas on how to get it to display the month name and the YTD text?

Thanks for the help

Mathias
Amarnath - 26 May 2006 09:48 GMT
I saw some other post as well, IIF evaluates both the truw and false
expression and then goes for comparison. so MonthName(13) will give error
since there is no 13. So reframe your conditions.

Amarnath.

> I've got this iif statement
>
[quoted text clipped - 13 lines]
>
> Mathias
Mathias - 30 May 2006 14:08 GMT
so umm care to point out those posts or tell me something i don't
already know???

any hint as to how to reframe my condition's would be of great help.
toolman - 31 May 2006 16:42 GMT
Mathias,
As far as posts go, just search for "IIF error" or "IIF doesn't work"
and you'll come up with tons of 'em.
My experience with this issue comes from trying to do divide by zero
error checking.  For example, =IIF(exp2 = 0,0,exp1/exp2); SSRS
evaluates both T and F and blows up when exp2 = 0.
The only way I've found to work around is to create a custom code
function then use that function in your expression.  For your situation
the function would be something like:
Public Function MonthValue (Exp1)
    If Exp1 = 13 Then
        MonthValue = "YTD"
    Else MonthValue = MonthName(Exp1)
    End If
End Function
Your expression would then be:
=code.MonthValue(Fields!Month.Value)
Good luck
toolman
Mathias - 31 May 2006 16:56 GMT
Thanks  for the help.  don't know why i never thought to look for iif
error.  I'll give that custom code a shot and see what I come up with.

Thanks
Mathias
> Mathias,
> As far as posts go, just search for "IIF error" or "IIF doesn't work"
[quoted text clipped - 15 lines]
> Good luck
> toolman
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.