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

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

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, June 2, 2014 1:06 PM
Points: 55, Visits: 109
Hello,
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


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 6:40 AM
Points: 11,248, Visits: 13,011
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

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