Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

report builder expression Expand / Collapse
Author
Message
Posted Friday, January 18, 2013 10:56 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, October 29, 2014 11:32 AM
Points: 43, Visits: 184
hello everyone -

The user just happened to find a bug in my report. Here’s what happened : The below expression was written to handle cases when the end date is greater than start date. However, I don’t have the code to handle cases when end date is the same as start date. My question is, can I use the IIF statement in report expression in such a way:
If end date > start date then
Use my existing code
Else if end date = start date then
Use my new code

How would I add the IIF statement to make it work?

=Switch(First(Fields!Work_Center.Value, "DataSet1") = "AZ1", 16000 * (12 - left(Parameters!starttime.Value,1) + left(Parameters!endtime.Value,1) - 1),First(Fields!Work_Center.Value, "DataSet1") = "AZ2",18000 * (12 - left(Parameters!starttime.Value,1) + left(Parameters!endtime.Value,1) - 1),(First(Fields!Work_Center.Value, "DataSet1") = "GAV1" or First(Fields!Work_Center.Value, "DataSet1") = "GAV2"),8000 * (12 - left(Parameters!starttime.Value,1) + left(Parameters!endtime.Value,1) - 1),First(Fields!Work_Center.Value, "DataSet1") = "GAV3",10000 * (12 - left(Parameters!starttime.Value,1) + left(Parameters!endtime.Value,1) - 1),First(Fields!Work_Center.Value, "DataSet1") = "ZED",9600 * (12 - left(Parameters!starttime.Value,1) + left(Parameters!endtime.Value,1) - 1))

Any help would be greatly appreciated.

Post #1409020
Posted Tuesday, January 29, 2013 2:33 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, January 21, 2014 12:48 AM
Points: 10, Visits: 158
=IIF(Enddate.value> Startdate.value,swith(............),IIF(Endate.value=Startdate.value,newexpression))
Post #1412834
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse