Monday, February 20, 2012

Possible bug in RS -Using the Now function in expression in a Snap

We have created a report that creates a historical snapshot. In the header,
we use the Now vb function to return the current date/time. However, the Now
function does not evaulate at the report execution time. Rather, it seems to
evaluate upon the first opening of the report for viewing. Thus, the snapshot
might have been taken yesterday, but if I open the report in a browser (for
the first time) today, the Page Header now says today (and will always say
that).
Additionally, when you export the report to Excel, the Now evaluates
again... so you get the current date/time in the page header of the Excel
cell.
I will try using the Execution time to get around this, but thought I'd pass
this along.Currently, page headers and footers are calculated at rendering time. This
is so that we can recalculate the page numbering when the report is
repaginated. In SQL 2005, we will change this so that the HTML and GDI
renderers will do this at processing / snapshot time while page oriented
formats will do this at rendering time. In a future version, we will change
these to be static as well.
--
Brian Welcker
Group Program Manager
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"dbconsulting" <dbconsulting@.discussions.microsoft.com> wrote in message
news:AF88D084-DE6E-4E01-B2AE-2BFB26C1B821@.microsoft.com...
> We have created a report that creates a historical snapshot. In the
> header,
> we use the Now vb function to return the current date/time. However, the
> Now
> function does not evaulate at the report execution time. Rather, it seems
> to
> evaluate upon the first opening of the report for viewing. Thus, the
> snapshot
> might have been taken yesterday, but if I open the report in a browser
> (for
> the first time) today, the Page Header now says today (and will always say
> that).
> Additionally, when you export the report to Excel, the Now evaluates
> again... so you get the current date/time in the page header of the Excel
> cell.
> I will try using the Execution time to get around this, but thought I'd
> pass
> this along.
>|||Well said by Brian. In case you really wanna show snapshot date/time in page
header do the following-
1. Make textbox named as TextBox1 in report and make it invisble. now put
=now as expression in it.
2. In page header make new text box and use expression =ReportItems!TextBox1.Value
Above code works cause reportItems collection is evaluated and rendering
time but it picks the value from TextBox1 which was processed at the time of
snapshot creation.
Problem solved! :o)
-Suneet Mohan
"dbconsulting" wrote:
> We have created a report that creates a historical snapshot. In the header,
> we use the Now vb function to return the current date/time. However, the Now
> function does not evaulate at the report execution time. Rather, it seems to
> evaluate upon the first opening of the report for viewing. Thus, the snapshot
> might have been taken yesterday, but if I open the report in a browser (for
> the first time) today, the Page Header now says today (and will always say
> that).
> Additionally, when you export the report to Excel, the Now evaluates
> again... so you get the current date/time in the page header of the Excel
> cell.
> I will try using the Execution time to get around this, but thought I'd pass
> this along.
>|||Why not use Globals.ExecutionTime ?
On Fri, 1 Apr 2005 13:17:02 -0800, dbconsulting
<dbconsulting@.discussions.microsoft.com> wrote:
>We have created a report that creates a historical snapshot. In the header,
>we use the Now vb function to return the current date/time. However, the Now
>function does not evaulate at the report execution time. Rather, it seems to
>evaluate upon the first opening of the report for viewing. Thus, the snapshot
>might have been taken yesterday, but if I open the report in a browser (for
>the first time) today, the Page Header now says today (and will always say
>that).
>Additionally, when you export the report to Excel, the Now evaluates
>again... so you get the current date/time in the page header of the Excel
>cell.
>I will try using the Execution time to get around this, but thought I'd pass
>this along.|||Yes, using =Globals.ExecutionTime instead of =Now would be the right
solution.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Matthew Brown" <octavius@.gmail.com> wrote in message
news:k8e251tn28vut7uk22e16h1koe1h4h94bk@.4ax.com...
> Why not use Globals.ExecutionTime ?
>
> On Fri, 1 Apr 2005 13:17:02 -0800, dbconsulting
> <dbconsulting@.discussions.microsoft.com> wrote:
>>We have created a report that creates a historical snapshot. In the
>>header,
>>we use the Now vb function to return the current date/time. However, the
>>Now
>>function does not evaulate at the report execution time. Rather, it seems
>>to
>>evaluate upon the first opening of the report for viewing. Thus, the
>>snapshot
>>might have been taken yesterday, but if I open the report in a browser
>>(for
>>the first time) today, the Page Header now says today (and will always say
>>that).
>>Additionally, when you export the report to Excel, the Now evaluates
>>again... so you get the current date/time in the page header of the Excel
>>cell.
>>I will try using the Execution time to get around this, but thought I'd
>>pass
>>this along.
>

No comments:

Post a Comment