Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


report builder expression


report builder expression

Author
Message
phamm
phamm
SSC Rookie
SSC Rookie (43 reputation)SSC Rookie (43 reputation)SSC Rookie (43 reputation)SSC Rookie (43 reputation)SSC Rookie (43 reputation)SSC Rookie (43 reputation)SSC Rookie (43 reputation)SSC Rookie (43 reputation)

Group: General Forum Members
Points: 43 Visits: 190
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.
abdulkalam.m
abdulkalam.m
Grasshopper
Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)

Group: General Forum Members
Points: 10 Visits: 168
=IIF(Enddate.value> Startdate.value,swith(............),IIF(Endate.value=Startdate.value,newexpression))
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search