This is a migrated thread and some comments may be shown as answers.

Getting Report grand Total in Report Footer

6 Answers 1238 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Khan
Top achievements
Rank 1
Khan asked on 26 Sep 2008, 06:04 PM
I have a text box on the report called txtTotal and I am using function =Sum(Fields.Amount) to get the total of all the txtTotalAmount values. I have placed this field in the  ReportFooterSection1 so I can get all totals on the last page only.

When I get the data back from the server, it will have multiple Total values that will be visible on txtTotal . Then I want to get the grand total amount in text box, txtTotalAmount. On the design time, I am getting the total, but when I view the report on the Web, the report shows the list of all the total values, not the Sum.
How do I resolve this issue?

Thanks

6 Answers, 1 is accepted

Sort by
0
Hrisi
Telerik team
answered on 29 Sep 2008, 02:39 PM
Hi Azam,

Sorry, but we do not understand the problem. The expression Sum(Fields.Amount) placed in the ReportFooter section will calculate the sum from the Amount field for all data rows from the DataSource. Expressions work with fields, not the values obtained from the textboxes. In a scenario you describe textbox txtTotal is placed in the ReportFooterSection1 and should calculate the sum of Amount. But you talk about textbox txtTotalAmount and we do not know were it is placed and what expression it contain.

We need much more details about the structure of your report. It would be nice if you help us with the source of the report in order to give you more concrete advice.

All the best,
Hrisi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Khan
Top achievements
Rank 1
answered on 29 Sep 2008, 07:10 PM
Thanks Hrisi

I don't know what do you mean by source of report, but I can give you the structure so you can better understand my report.

My report has Following sections

1. Report Header : This contians the basic report Info.
2. Details: This has a field txtTotal (Fields.TotalAmt) for each line item.
3. Report Footer: This section has txtTotalAmount to get the grand total of all the line items in Details. The function I am using is =Sum(Fields.TotalAmt) to get the Sum / total of all the values in the txtTotal field for all line items.

I am grouping by line item so that all the line items are grouped totether. This way the same line item txtTotal  will be added.

For example:

Line   txtTotal 
1        5
2        5

Preview shows in txtTotalAmount  a total of 10.

At design time, I am using Data daptor to get the data set. The txtTotalAmount field in the Preview shows the grand total of all the items.

At the run time, when I am running the report through the web site, I am using XML to rerturn the dataset. The report does not give me the grand total but it gives each individual vlaues form txtTotal (Fields.Qty).

For example:

Line  
txtTotal 
1        5
2        5

Webpage shows in txtTotalAmount  a total of 055.

Does this help?



0
Hrisi
Telerik team
answered on 30 Sep 2008, 08:24 AM
Hi Azam,

From what you explain we guess that your run-time dataset returns a string for the Qty field. Are you using xsd to populate the schema of your xml data? If you are not, most probably that is the reason for the problem.

Try to use this expression in the txtTotalAmount:
 =Sum(CInt(Fields.Qty))


Drop us a line if that is not the case.

Greetings,
Hrisi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Khan
Top achievements
Rank 1
answered on 03 Oct 2008, 03:48 PM
Hi Hrisi

I changed the expression of the formula as you described, added the CInt and now I can see the results that I am looking for. Can you please explian why it would do that? Why do I have to add the CInt to the expression? This is just for my understanding.

Thanks a lot.

Azam
0
Rossen Hristov
Telerik team
answered on 03 Oct 2008, 04:50 PM
Hello Azam,

The CInt function is used to convert the string to int so that arithmetic calculations will be possible.

Greetings,
Ross
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Khan
Top achievements
Rank 1
answered on 03 Oct 2008, 06:44 PM
Thanks to all who helped on this issue :)-

Azam
Tags
General Discussions
Asked by
Khan
Top achievements
Rank 1
Answers by
Hrisi
Telerik team
Khan
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or