Hi
I'm evaluating StimulReport for use in our product and I'm trying to work out how to implement one of the requirements we have. I need to print the total of a column at the bottom of each page. The last page(s) of the report should be a summary giving a list of all the pages along with their totals.
e.g.
- Page 1 -
1
2
3
Page Total: 6
- Page 2 -
4
5
6
Page Total: 15
- Page 3 -
Page 1: 6
Page 2: 15
What is the best way to do this using StimulReport?
I've tried a couple of things, but I couldn't get it to work for me. I thought of perhaps using a script attached to the GetValue event of the StiText in the DataBand to update a variable containing the total for the page, but I couldn't work out how to define a variable for use in the event script. I then tried to use the StiText in the page footer to store the value, but once again I couldn't figure out how to refer to it from the script.
Any suggestions would be appreciated.
Gareth Marshall
Page totals
Page totals
Thanks for your message.
Add to total function name symbol c. For example:
You can read more about this at http://stimulsoft.com/Documentation/en/Online/330.html
Thanks.
Add to total function name symbol c. For example:
Code: Select all
cSum(DataBand1, Customers.Count)
Code: Select all
cCount(DataBand1)
Thanks.
Page totals
Thank you very much for your help.
I've run into two problems trying to produce the summary at the end though:
1. I'm finding the last page before the summary is missing from the listed totals.
I've created three variables in the dictionary:
rpt->Dictionary->Variables->Add( "Variable", "m_collectionsSummary", "m_collectionsSummary", String("").GetType(), "", false );
rpt->Dictionary->Variables->Add( "Variable", "m_pageNo", "m_pageNo", Int32().GetType(), "0", false );
rpt->Dictionary->Variables->Add( "Variable", "m_pageTotal", "m_pageTotal", Double().GetType(), "0.0", false );
And then I've added this code to the DataBand's RenderingEvent:
m_pageTotal += Double.Parse( RptData.Tot )
And this code to the PageFooterBand's BeforePrintEvent:
if (m_pageNo > 0) {
m_collectionsSummary += "\nPage " + m_pageNo + ": " + m_pageTotal;
}
m_pageNo += 1;
m_pageTotal = 0;
The summary page contains a StiText with the text set to {m_collectionsSummary}. When report is printed, all pages except the last page appear in the list. How can I ensure that all the pages will appear in the summary?
2. If there are enough pages, the StiText contains too much text to fit onto one page. It just fills up the page it is on, but doesn't spread itself over enough pages for the data it contains. I tried setting CanBreak to true, but that didn't seem to make any difference.
Thank you for your time.
I've run into two problems trying to produce the summary at the end though:
1. I'm finding the last page before the summary is missing from the listed totals.
I've created three variables in the dictionary:
rpt->Dictionary->Variables->Add( "Variable", "m_collectionsSummary", "m_collectionsSummary", String("").GetType(), "", false );
rpt->Dictionary->Variables->Add( "Variable", "m_pageNo", "m_pageNo", Int32().GetType(), "0", false );
rpt->Dictionary->Variables->Add( "Variable", "m_pageTotal", "m_pageTotal", Double().GetType(), "0.0", false );
And then I've added this code to the DataBand's RenderingEvent:
m_pageTotal += Double.Parse( RptData.Tot )
And this code to the PageFooterBand's BeforePrintEvent:
if (m_pageNo > 0) {
m_collectionsSummary += "\nPage " + m_pageNo + ": " + m_pageTotal;
}
m_pageNo += 1;
m_pageTotal = 0;
The summary page contains a StiText with the text set to {m_collectionsSummary}. When report is printed, all pages except the last page appear in the list. How can I ensure that all the pages will appear in the summary?
2. If there are enough pages, the StiText contains too much text to fit onto one page. It just fills up the page it is on, but doesn't spread itself over enough pages for the data it contains. I tried setting CanBreak to true, but that didn't seem to make any difference.
Thank you for your time.
Page totals
Set property ProcessAtEnd of StiText with {m_collectionsSummary} to true. With this property content of StiText will be processed after report rendering is finished.garethm wrote:Thank you very much for your help.
I've run into two problems trying to produce the summary at the end though:
1. I'm finding the last page before the summary is missing from the listed totals.
I've created three variables in the dictionary:
rpt->Dictionary->Variables->Add( "Variable", "m_collectionsSummary", "m_collectionsSummary", String("").GetType(), "", false );
rpt->Dictionary->Variables->Add( "Variable", "m_pageNo", "m_pageNo", Int32().GetType(), "0", false );
rpt->Dictionary->Variables->Add( "Variable", "m_pageTotal", "m_pageTotal", Double().GetType(), "0.0", false );
And then I've added this code to the DataBand's RenderingEvent:
m_pageTotal += Double.Parse( RptData.Tot )
And this code to the PageFooterBand's BeforePrintEvent:
if (m_pageNo > 0) {
m_collectionsSummary += "\nPage " + m_pageNo + ": " + m_pageTotal;
}
m_pageNo += 1;
m_pageTotal = 0;
The summary page contains a StiText with the text set to {m_collectionsSummary}. When report is printed, all pages except the last page appear in the list. How can I ensure that all the pages will appear in the summary?
You need set CanBreak property of Databand too.2. If there are enough pages, the StiText contains too much text to fit onto one page. It just fills up the page it is on, but doesn't spread itself over enough pages for the data it contains. I tried setting CanBreak to true, but that didn't seem to make any difference.
Thanks.
Page totals
Doing this prevents the size of the StiText (or perhaps the band its on) from being calculated correctly. It doesn't grow to accommodate all the text that is on the StiText, but just displays at the size originally specified. Is there a way to ensure that the size is correctly calculated?Set property ProcessAtEnd of StiText with {m_collectionsSummary} to true. With this property content of StiText will be processed after report rendering is finished.
Page totals
At this moment it's impossible.