Group Page Totals and Carried Forward Totals - ssrs-2008

I have googled a lot about this but found nothing useful. This has been asked before here but noone has responded.
I have a tablix that presents grouped data with an amount column:
Tablix (data)
Name (group)
Amount (rows)
If the "Name" group spans more than one page I want to show a page total for the sum of the amounts present on the first page. On the next page the carried forward total of the previous page must be shown.
I have tried many things, especially with my custom assembly (like keeping a dictionary with the total of each group and in the footer of the report try to show the total etc). The thing that really messes up any implementation is the order where report's header, body and footer are "executed".
Any ideas or suggestions?

Due to:
The fact that there is no way to get whether one instance of the grouped data are split in more than one page at the detail level (so that the carried forward total can be shown below the repeated column headers)
The page header and footer are always "evaluated" after the body elements
You can only reference on ReportItem in the expressions used in the page header and footer
You cannot make changes to the body elements from the page header or footer (mostly because of the point above)
You cannot extend the tablix control to add your own functionality
I decided to go with showing the group page total in the footer, storing it and the picking it up to show it to the next page.
This is done by having a cumulative total column using
= IIf(RunningValue(Fields!AmountDC.Value, Sum, "Group1") <> Sum(Fields!Amount.Value, "Group1"), code.SetTotal(RunningValue(Fields!Amount.Value, Sum, "Group1")), Nothing)
which for the last detail row is setting it to "Nothing"
In the footer a textbox picks up the last value of that cumulative total field.
= code.SetTotal(Last(ReportItems!CumTotal.Value))
and stores the current total in a private field in the embedded code.
Private running As Double = 0
Public Function SetTotal(ByVal val As Double) As Double
running = val
Return val
End Function
Public Function GetTotal() As Double
Return running
End Function
And last in the page footer the stored total is picked up
= code.GetTotal()
It is too simple, but still it is the closest I could get with what I have after many trials!

Try this post ...separating pages answers..
This is not a direct answer but if youy get creative and separate the page using the sql or use a running total , this could get you started.
However to answer your question its not a feature in ssrs.

Related

Do not print a particular field on first page of the report

I am working on crystal reports. I want to avoid printing a field on the first page of the report, but print it on rest of the pages. I am also resetting the page number at group level. So if I suppress the field on page 1 it also suppresses on the page where the new group starts and the page number is reset to 1, which I don’t want.
If the field is suppressed on this condition:
RecordNumber = 1
it should behave like you want, i.e. it's not shown on the very first page, regardless of the CR page numbering.
Note: this one will only work if the second record started on page 1, too.
If I'm understanding your question correctly, it sounds like you are using a formula to suppress the field when PageNumber = 1, and it is suppressing the field on the first page of the report, but when you get to the next record in the group the page number resets to 1 and the field is suppressed again, when you want it to be shown.
I would try updating the suppression formula to the following.
PageNumber = 1 AND GroupNumber = 1
If you have multiple levels of grouping in your data, things can get a little interesting though. The GroupNumber function does not allow you to specify which group it is enumerating and instead returns record number for the inner most group that the function is contained within.

jasper report show count on footer of a specific query

am very new to jasper report
also I have tried looking at videos but can not seem to get this one concept
basically there is this main query which i have
select * from table
which is populated in the details area
however i want a second query
select count(*) from table where name = "tim"
and put the count on the footer
can this be done using jasper
any tutorial to this concept or guidance would be helpful
to sum up the details area should show all the data where as the footer should only show counts of a few things.
You can only have one DataSet (therefore query) for the report. In your case this is your main report select * from table, which seems to be working well.
You have two options for adding the information you want:
(and I would say the better option) is to add a variable $V{tim_count} which is configured as:
initial value 0
expression value "tim".equals($F{name}) ? 1 : 0"
calculation function sum
there are multiple ways to increment this variable, so I'll leave that with you. In the footer you would then add a text field with the $V{tim_count} variable as it's contents.
You can read about variables here https://community.jaspersoft.com/wiki/variables
You can add an object that has it's own DataSet:
Table
List
Subreport
You would then be able to add your query to that object and display it appropriately. As you can see, displaying a COUNT is not really the most appropriate way to do this.
Note - I don't suggest this way

how to put two records same page

I have a page with exactly same pre-format data in the left side than in the right and i need that my result query data that gives me example 10 records i need to show in the left side first record, in the right side second record on first page and then do the same with all records Now i make a first report wich calls another one, first report gives me data but i can only show one record per page in second report, i need 2 records per page, one in left side and another in another side of the page...
Assuming that each of your records will take up more than half a page, this should be as simple as changing the report to have 2 columns.
In iReport, select the report itself (top element) in the report inspector, then change the Columns property to 2. Alternatively, in the JRXML, add/change the attribute columnCount on the jasperReport element to 2.
If your records occupy less than half the page height each, you will end up with multiple records per column. To get around this, create a group with the expression $V{REPORT_COUNT} and check the "Start on a new column" property (set the isStartNewColumn attribute in JRXML). This will create a new column for each record.

In jasperreports how to force page break before a group title if there is no room for any subsequent rows

Is there a way of forcing a page break before a group title if there is no room for ANY of the subsequent rows? It would be nice to be able to query the amount of space left on the current page.
There is a property called min height to start new page you will find on the group header. Make this a sum of the height of your detail row and the group header as the lowest amount (more if you want it to have at least 2 rows of detail). I also suggest setting the Keep Together to true as well.

Set the height of Details section Crystal Reports

The no of items in my invoice never gets more than 10. When its only one item in invoice(one row in details section) the report footer shows very up.
I want that I should fix 10 rows for the details section, when there are less rows, the remaining rows to make it 10 should be showed as blank lines.
I need the footer to appear at the same place all the time, irrespective of how many items are there in the invoice(never gets more than 10).
Please suggest solution.
Just use Sub Report and Fix the height of the sub report
then you will be able to display fix page.
I am not exactly sure what you are asking, but I will make some guesses with possible solutions.
If you print multiple invoices per report, you can group on the invoice designator, and set the report to start every invoice on a new page. In addition, you can force a new page when the record count goes over 10 rows. There are various ways to do this, but the simplest would be to add a counter that is set/reset at the start of an invoice, and then conditionally force a "new page before" if that counter reaches 11. You can also set this to force a new page for every n + 1 records (the 11th record, the 21st record, the 31st record, etc.)
If you just don't want the report footer to show up, you can either suppress it or issue a "new page before" on report footer. This is handy if you keep a summary page for reference (# of invoices in run, total balances, etc.).
If you just don't want a floating footer, you can select "print at bottom of page" for any section. This is handy for group totals. That, with "Repeat Group Header on Each Page", you can get some very nice looking invoices.
to fix height of detail section ..suppose i want size of 8 rows/records then
right click on detail section ->section expert ->on paging tab-> check on New page before beside button (x+2) write formula below given..
IF Remainder (RecordNumber, 8) = 0 THEN
TRUE
ELSE
FALSE
I know this question is really stale, but here's how to do what the OP asked.
You need to do 2 things. Find out the amount of real estate you need on the page for the 10 rows, and create a group footer that is that size directly beneath the detail line (e.g 2" or 5 cm).
Then, go into the section expert for the detail line and check the Underlay Following Sections box.
If you are ever going to have more than 10 detail lines, you also need to go to New Page after on the Paging tab and put in 10.
Put all fields Top = 0
Decrease section height.
Now, you have to set fields top dynamically.
Like this:
cr.Section1.ReportObjects.Item("Line1").Top = 0
cr.Section1.ReportObjects.Item("Line2").Top = cr.Section1.ReportObjects.Item("Line1").Top + cr.Section1.ReportObjects.Item("Line1").Height