Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

need expression for startdate and end date Expand / Collapse
Posted Wednesday, April 30, 2014 9:07 AM


Group: General Forum Members
Last Login: 2 days ago @ 2:17 PM
Points: 158, Visits: 416
I have an ssrs report in the header I am trying to display report start date and report end date.

This is old active report we are converting to ssrs.
In the active report start date and end date is like this

fiscalYear = System.DateTime.Now.Date.Year;
claimMonth = System.DateTime.Now.Date.Month - 1;

startFY = Convert.ToDateTime(Convert.ToString(claimMonth) + "/01/" + Convert.ToString(fiscalYear-3));
endFY = Convert.ToDateTime(Convert.ToString(claimMonth) + "/01/" + Convert.ToString(fiscalYear));

this.repStartFY.Text = startFY.Date.ToShortDateString();
this.rptEndFY.Text = endFY.Date.ToShortDateString();

In ssrs report I taken a text box and written expression as

="Report Start Year Date:" + System.DateTime.Now.Date.Month-1
+ "/01/" + System.DateTime.Now.Date.Year-3

="Report End Year Date:" + System.DateTime.Now.Date.Month-1
+ "/01/" + System.DateTime.Now.Date.Year

But its showing error not sure where I am doing mistake;Any help..
Post #1566446
Posted Wednesday, April 30, 2014 11:10 AM



Group: General Forum Members
Last Login: 2 days ago @ 12:32 PM
Points: 10,807, Visits: 14,829
You need to convert your Month and Year to strings in order for the "+" to be concatenation and not addition and you can't add a string and integers.

You can use CStr(Number) or (Number).ToString()

Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #1566515
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse