Uma (whoever that is) has posted a question in response to https://spacefold.com/lisa/2007/09/19/Dynamically-loading-reports-in-ReportViewers , which as far as I can tell is completely unrelated to that post <g>.
Hi i want to display subtotal of first page in the top of next page in rdlc report and i am using page break of 10 in every page.
Unrelated to dynamically loading reports or not, the question certainly covers a subject that I'm familiar with and will address here in case I haven't in the past.
First, just in case I haven't already talked about conditional page breaks on <item number>, this is just a variant of other ROW_NUMBER() techniques we've used to resolve past problems. Let's say my SQL query looks something like this, in Uma's case:
SELECT
Sales_No, Customer,Order_Quantity,
CEILING(CAST( ROW_NUMBER() OVER (ORDER BY Customer) / 10 AS
Numeric(10,2))) AS Grouper
FROM OrderHeader
ORDER BY Customer
… where the "/10" in the above query is determined by the "page break of 10" in Uma's scenario. OK so far?
So now my group break is simply the expression =Fields!Grouper.Value, and I set this group to page break at end.
NB: I always think it's nice to let SQL do most of the work, if I can.
In your situation, you might be doing it differently, or in a more RS-oriented way. That's okay, how you happen to be determining your page break is not really germane to Uma's question at all. The point is, however you're doing your grouping… the work is almost all done already. It looks as though we have a lot of work left, maybe, but really, it's almost done.
So now let's say we have a subtotal expression (for Uma) that, in my example, looks like this, in the footer of this group: =Sum(Fields!Order_Quantity.Value).
And let's say we change that footer expression to do this: =Sum(Fields!Order_Quantity.Value) & Code.MyUdf(Sum(Fields!Order_Quantity.Value)).
And let's say we write the following (really minimal) amount of code:
Public PrevPage As Double = 0
Function MyUdf( t As Double) AS String
PrevPage = t
Return ""
End Function
… and now let's say we put a textbox in the group header with the following expression: =IIF(Code.PrevPage = 0,"",Code.PrevPage) (the IIF() is just to take care of the first page, because I'm too lazy to worry about whether this is the most elegant way to do it or not).
That's all she wrote, folks. Seems to work just as you'd want. No big deal, really.
Why the title of this post?
First, you should know it's a quote from "Little Big Man". I'm taking a "Serenity" break, just for kicks.
Second, this is one of those times when multiple export types (Excel rendererer, PDF renderer, etc) don't get in the way. You notice I haven't put anything in the page header; I'm avoiding any issues of "what sequence does everything happen in" in the various rendering engines that way. Sometimes the magic can… just work.