on 03-23-2007 7:06 AM
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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>
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.