Hello,
I have a multi-page report which needs to list the total for the page
in the page footer, the total for all the previous pages, and the
current overall total. For example:
Page Total: 25
Total from previous pages: 40
Overall total: 65
I have the items and their prices listed in the body detail area, and
the totals appearing in the page footer. So far, I have Page total
working, and Overall total, using these expressions:
Page Total: =Sum(ReportItems!txtitemPrice.Value) (where txtItemPrice
is the value in the body area
Overall total: =Last(ReportItems!txtRunningTotal.Value) (where
txtRunningTotal is a RunningValue summation of txtItemPrice)
These work fine. My problem is getting the total from the previous
pages. This should be easy, as its just a simple subtraction. Total
from previous pages = Overall total - Page Total
However, I get this error: An expression in a page header or footer
can refer to only one report item
How can I get around this?On 19 Apr., 07:13, alku83 <alk...@.gmail.com> wrote:
> Hello,
> I have a multi-page report which needs to list the total for the page
> in the page footer, the total for all the previous pages, and the
> current overall total. For example:
> Page Total: 25
> Total from previous pages: 40
> Overall total: 65
> I have the items and their prices listed in the body detail area, and
> the totals appearing in the page footer. So far, I have Page total
> working, and Overall total, using these expressions:
> Page Total: =Sum(ReportItems!txtitemPrice.Value) (where txtItemPrice
> is the value in the body area
> Overall total: =Last(ReportItems!txtRunningTotal.Value) (where
> txtRunningTotal is a RunningValue summation of txtItemPrice)
> These work fine. My problem is getting the total from the previous
> pages. This should be easy, as its just a simple subtraction. Total
> from previous pages = Overall total - Page Total
> However, I get this error: An expression in a page header or footer
> can refer to only one report item
> How can I get around this?
Hi,
SSRS checks, how often ReportItems is used in an expression. You can
bypass this by defining a function like the following in the code tab
of the report properties:
Public Function CalcPreviousPageTotal(RI as ReportItems,
OverallTotalItemName as String, PageTotalItemName as String) as
Integer
Return CInt(RI(OverallTotalItemName).Value) -
CInt(RI(PageTotalItemName).Value)
End Function
In your footer textbox you now code:
=Code.CalcPreviousPageTotal(ReportItems, "Overall total", "Page
Total")
Hope that helps,
Michael|||Thanks, that's exactly the sort of solution I was looking for. That's
solves a number of my other problems too.
My only remaining problem now is that I have quite a lot of
information in the Page footer. However, when I go to Preview the
report and look at the Print Preview, the header and footer completely
disappear. There is still blank space there where they should be, but
nothing appears.
Any idea why this might happen?|||On Apr 20, 4:20 pm, alku83 <alk...@.gmail.com> wrote:
> Thanks, that's exactly the sort of solution I was looking for. That's
> solves a number of my other problems too.
> My only remaining problem now is that I have quite a lot of
> information in the Page footer. However, when I go to Preview the
> report and look at the Print Preview, the header and footer completely
> disappear. There is still blank space there where they should be, but
> nothing appears.
> Any idea why this might happen?
Well I solved this problem myself, basically it seemed like there was
too much information for the page, so I increased the height a little,
and squashed things in a bit more, and its all good now.
No comments:
Post a Comment