cancel
Showing results for 
Search instead for 
Did you mean: 

about table.

Former Member
0 Kudos

i have a table in my view,there is a price column in it.

now i wanna display the total price in the view......

but i am so confusing where put it in.

i have a idea that is <b>putting it to the right of table'page function</b> .

but i cann't realize it,how to realize that?

thanks.

Accepted Solutions (0)

Answers (4)

Answers (4)

nitin_mahajan2
Contributor
0 Kudos

Let me first understand your problem.

You have a table having some columns and one of the column is Price(Total Price).

Now you want to calculate a value and put it somewhere in the row(ur idea of putting it to the right end of the table).

Is that right?

If that is so and you already have the values that u need in the calculation. You can create the column at the runtime.

Add a column to the table and set the calculated value to that column.

use textview editor to create the column.

Do this processing in wdModifyView of the view.

Former Member
0 Kudos

Hi wingoal,

If you do not want to add an additional row to your table,

1) you can create a text view/ input field anywhere on your view,

2) attach a context variable "Total" to that text view/input field,

3) Calculate the total from the table

4) Set the context variable "Total" with the value you obtained in step 3

Here is the detailed procedure to calculate the total:

<b>int size = wdContext.node<tableNodeName>.size();

int total = 0;

for (int i = size - 1; i>=0; i--)

{

total = total + wdContext.node<tableNodeName>.get<tableNodeName>ElementAt(i).get<nameOftheattributeforPrice>();

}</b>

Now, set the context attribute "Total" with the value obtained in the variable "total"

<b>wdContext.currentContextElement.setTotal(total);</b>

Thanks and Regards,

Reena

former_member189631
Active Contributor
0 Kudos

Wingoal,

A table is nothing but a set of rows . each row in a table contains set of fields called colunms.Since each row in table contain same set of fields as other row in the same table.So u can not append a row whose fields varied than previous row.

But u can add one more column called total price.and u can calculate cumulative total for each row. The last row give u the total price .

[Awarding Points always appreciated ]

Regards,

Ramganesan K.

former_member189631
Active Contributor
0 Kudos

Hi Wingoal,

Do u want to display the Total Price Right ?.

U can create tool Bar Input field/Text Viewfor ur table and display thr.

Step1:Right click ur table node in root element Container

Step2:Create Tool Bar UI element for ur Table

step3: Create Context Attribute for TotalPrice.

Step4:Bind this node with Tool Bar UI element (iNPUT FIELD/Textview)

step5: Write Appropriate code for calculating Toatl Price.

Hope this will solve ur problem.

Regards,

Ramganesan K.

Former Member
0 Kudos

sir,

i know that is one of the resoved question ways.but that would be result in additional row in the table (one is for header).......

Former Member
0 Kudos

Hi,

Please go through this tutorial, which displays total price of a column in a table.

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/developing%20with%20tables%20in%20web%20dynpro.pdf">working with table</a>