Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RDLC report footer with value from "Current Record"

I don't know if its possible or not, but thought I'd ask. Many times reports need data grouping to have anchored to the bottom of the report some summary information, such as invoices. You don't want the totals shifting UPwards based on only 2 detail lines vs another with 20. I've tried working with using the Tablix bound to the data source for the output but couldn't get it quite right... It would either shift up, or force break and appear at top of following page.

So, if anyone has some ideas to help resolve that, that too would be great.

My second approach was to just use a simple report page footer. However, the overall "Report" page is not technically "BOUND" to any datasource. So, if I put a textbox in the footer and want it to show something, I can't pick "the most recent row from the datasource associated with the Tablix", it always requires an aggregate, such as

=First(Fields!SomeField.Value, "SomeDataSource" )
=Sum( ...
=Last( ...   
etc...

I just want it to have whatever was the most recent... so I tried to use report variables to create one and was thinking to have it get updated per row being processed, so it always had whatever the "latest" value was and I could just dump that value at the bottom of the report.

Any suggestions to either would be great. Thanks.

like image 520
DRapp Avatar asked Nov 05 '22 05:11

DRapp


2 Answers

I know this is an old question, but I had a very similar problem and came up with a unique solution. I had a statement that needed to have the payment slip print at the bottom of the page even if the statement line items wrapped over to another page. I solved it by:

  • Making all rows in the report a uniform height.
  • Calculating how many rows were required to fill the page (minus the height of my payment slip.
  • Getting the number of line items in the statement.
  • Calculating the remaining number of rows needed to push my payment slip to the bottom of the page.
  • Adding a sub-report with the calculated number of blank rows to pad out the necessary space between the line items and the payment slip.

The advantage of that approach was that I could generate bills for multiple customers, and since the padding is part of the group it would be customized for each customer's bill and bottom-justify the pay slip for each of them.

You can use a similar approach to push your "footer" info to the bottom of your page. Since it is still inside of your data group you'll have access to the data values you need as well.

like image 192
M. Hall Avatar answered Nov 28 '22 18:11

M. Hall


In the footer you can refer to report item from report body, like this:

=ReportItems!myFooterValueTextBox.Value

The catch is that you can refer to only one report item in your footer, so you may need to add invisible footer row in your table and concatenate all your totals into one cell (myFooterValueTextBox) in that row:

=First(Fields!SomeField.Value, "SomeDataSource") + "|" +
 Sum(...) + "|" + .... +
 Last(...)

I used pipe as deliminator in my example, so then in the footer, I would split the string and place values in appropriate containers, like this:

=Split(ReportItems!myFooterValueTextBox.Value,"|")(0)
like image 22
InitK Avatar answered Nov 28 '22 19:11

InitK