all groups > sql server reporting services > october 2006 >
You're in the

sql server reporting services

group:

displaying date ranges in the report header


displaying date ranges in the report header jai
10/20/2006 10:19:04 AM
sql server reporting services: I am using a table to structure my report.

Body of the report

Table header
Group Header
Details
Group Footer
Table Footer

Earlier I had put the report name with the company logo in the report
header section but now I moved it to the body of the report just above
the table. I am trying to display the date range next to the report
name. I am trying to use an expression saying that if the date
parameters are NULL, then print the date today() else print the two
date parameters with a hyphen seperating them. On running the report it
gives an error that I caanot use expressions in a text box or in the
report header. I am creating a variable in the dataset as a calculated
field and then setting the expression.

Can someone please help??

Regards

Jaideep
Re: displaying date ranges in the report header jai
10/20/2006 12:08:20 PM
Chris,

Thanks for the help. I am trying to set this expressions and it keeps
telling me that dbnull cannot be used.

IIf((Parameters!date1.Value = System.DBNull And Parameters!date2.Value
= System.DBNull),Today(),(Parameters!date1.Value & "-" &
Parameters!date2.Value))

I have two parameters. I am using a stored proc in the background. If
ther parameters are null it gives me data for the previous day.

I need to show the report heading as the <Report name> <date>/<date1 -
date2>

I think it the system does not want to accept the system.DBNull

Regards

Jaideep
[quoted text, click to view]
Re: displaying date ranges in the report header jai
10/20/2006 12:10:47 PM
I think I got it. I should use is Nothing instead of System.DBNull.

I will try what you had said.
Jaideep
[quoted text, click to view]
Re: displaying date ranges in the report header jai
10/20/2006 12:53:51 PM
Chris,
I created the text box in the body and set the expression which is
being displayed properly. Now I created another text box in the report
header section and in the expression I said
ReportItems!TextBox5.Value

It is giving me an error --
The Value expression for the textbox 'textbox17' contains an error:
The expression referenced a non-existing reportitem in the reportitems
collection.
Preview complete -- 0 errors, 1 warnings

I can understand the error but how do i add something to the
reportitems collection???

Jaideep



[quoted text, click to view]
Re: displaying date ranges in the report header Chris Conner
10/20/2006 1:34:51 PM
Yes, specify the expression in a textbox (assume the textbox name is
textbox5 on the body and make the visibility property FALSE.

Next, in the report header, for the expression use:
=ReportItems!TextBox5.Value

=-Chris

[quoted text, click to view]

Re: displaying date ranges in the report header jai
10/20/2006 2:42:39 PM
Thanks that did the trick. But I found another problem. If the date
range is one day apart then the text box displays the correct values
but if the range is more than two days, then it does not display the
values but the report returns the data.

Any ideas???

Jaideep
[quoted text, click to view]
Re: displaying date ranges in the report header Chris Conner
10/20/2006 3:13:23 PM
Don't use that = use instead iif((Parameters!date1.Value = Nothing ....

to test for nullability.

=-Chris

[quoted text, click to view]

Re: displaying date ranges in the report header Chris Conner
10/20/2006 4:14:10 PM
I forgot to mention - it is CASE sensitive.. by default, the textbox names
are in lowercase. Sorry about that.

=-Chris

[quoted text, click to view]

Re: displaying date ranges in the report header jai
10/23/2006 10:01:37 AM
Chris,
I have been seeing that if the report is more than one page, the system
prints the date range in the report header on the last page.

I checked the properties but did not find anything unusual there.

Regards

Jaideep
[quoted text, click to view]
AddThis Social Bookmark Button