cancel
Showing results for 
Search instead for 
Did you mean: 

Adding totals to the bottom of table columns

Former Member
0 Kudos

Hi

I have a table displaying on my PDF report.

I need to display sum totals at the bottom of all the columns.

Could someone pls explain to me in detail (because i R a n00b) how to add totals to the bottom of the columns.

thanks in advance

Anton Kruse

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

For this you include a button on the form and attach a script to it in the event "click".

A simple for loop which reads the columns and gets a sum of it. (this can be written in java script".

or else in form calc.

Hope this helps.

Best Regards,

Saujanya

Former Member
0 Kudos

thanks Saujanya, but it is very unpractical to get users to click a button before they can see totals. These need to appear when the page loads.

pls could you describe in detail how I would use form calc.

thanks

Anton

Former Member
0 Kudos

Hello Anton,

Since it is a report, i dont think some script is required on the form.Instead you can

read the data from the form using a fn module and produce the report accordingly.

Can you gimme more details inorder to make out the issue better.

Best Regards,

Saujanya

Former Member
0 Kudos

Hello,

if you want to display the total of field1 in the table.Write the below code on the total field.

$ = Sum($record.table.data[*].field1)

Former Member
0 Kudos

thanks Pavan

I'll give that a try and award points accordingly.

Saujanya

I cannot use fn module as there is no ABAP backend. Our models are imported from JARs.

Model context is then used as dataSource on PDf report.

regards

Anton Kruse

Former Member
0 Kudos

Hi Pavan

I put the following in the binding of the total field:

$ = Sum($record.MonthlyList.BonusDataPerShift[*].numberOfHoles)

but I just get an error.

Am I placing it in the wrong place?

pls help

thanks

Anton Kruse

Former Member
0 Kudos

Is the total field is placed in body page or master page.If you placed the field in body page you have to write the code in Formcalc and under form ready.No binding to the total field

Former Member
0 Kudos

The total field is placed in the body page in a separate subform.

The field is a numeric field type.

In the following string;

[code]$record.table.data[*].field1[/code]

Does the 'table' refer to the name of table subform in the hierarchy view or the name of the node in the data view?

thanks

Anton Kruse

Former Member
0 Kudos

yes,

Drag the field from the dataview to layout, copy the binding and paste the same to the total field

Former Member
0 Kudos

Thanks it is working now, however my problem is now this:

The table gets repeated on the page and the totals for the first table are also displaying under the second table. How can i get these totals to recalculate for each occurance of the table?

thanks

Anton Kruse

Former Member
0 Kudos

Can you give me the hierachy of table design! Also how you have designed in the laout with binding

Message was edited by:

pavan meda

Former Member
0 Kudos

I managed to fix it, but not by using the formcalc. I created new total attributes and filled them programatically by looping throught the nodes.

thanks all for helping.