Totaling Text Fields

Stimulsoft Reports.NET discussion
Post Reply
mmurdock
Posts: 94
Joined: Tue Mar 20, 2007 4:59 pm

Totaling Text Fields

Post by mmurdock »

I have a text filed that is calculating totals based on detail bands. I would like to get a grand total for the report. Is there a way to total up text fields such as {Sum(text1.value)}?

Thanks,

Mat Murdock
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Totaling Text Fields

Post by Edward »

Hi Mat,

Please use the following expression:

{Totals.Sum(MyDataSource,MyDataSource.MyDataColumn)}

Please open attached sample in the Demo.exe sample application and see fields with Red background.

Thank you.
Attachments
133.Master-Detail-SubdetailAndTotals.mrt
(42.19 KiB) Downloaded 210 times
mmurdock
Posts: 94
Joined: Tue Mar 20, 2007 4:59 pm

Totaling Text Fields

Post by mmurdock »

I don't think that does what I need. Here is the layout of my report

Equipment Item (kimr_equipment)
--Rental Invoice (kimr_depreciated_band)
--Rental Maintenance (kimr_ap_job)
--Acquisition Freight (kimr_po_distributions_band)

So I have a master item, then 3 detail bands under it. I have the following calculation that show on the master band that takes totals from some of the detail bands and does a calculation to find book value. This calculation is as follows:

{(kimr_equipment.acquisition_cost + Totals.Sum(kimr_po_distributions_band,kimr_po_distributions.cost_difference)) - Totals.Sum(kimr_depreciated_band,kimr_depreciated.rental_cost)}

Now at the bottom of the report on the report summary band they want to total up the results of that field that is in the master band. Any ideas on how to do this?

Thanks,

Mat
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Totaling Text Fields

Post by Edward »

Hi Mat,

Unfortunately in this case you have to use variables to calculate the overall results.

Thank you.
mmurdock
Posts: 94
Joined: Tue Mar 20, 2007 4:59 pm

Totaling Text Fields

Post by mmurdock »

Can you give me an example of this with variables. I'm having a bit of a trouble figuring them out.

Thanks,

Mat
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Totaling Text Fields

Post by Edward »

Hi Mat,

In the BeforePrintEvent of the DataBand on which these text fields have been placed you need to write the following:

MyVariable = MyVariable+ExpressionWhichYouCalulateInEachTextComponent;

MyVariable is a variable of decimal type. You must declare this variable in the Dictionary if the report.

It does not matter that stiTexts are in the Detail bands. They will be calculated in any case.

If still in trouble, please send a report template, data and a brief explanation to support[at]stimulsoft.com.

Thank you.
mmurdock
Posts: 94
Joined: Tue Mar 20, 2007 4:59 pm

Totaling Text Fields

Post by mmurdock »

That worked thanks.

Mat
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Totaling Text Fields

Post by Edward »

Hi Mat,

Please let us know if any additional help is required.

Thank you.
Post Reply