on 04-16-2008 8:13 AM
Hi folks,
In my application i have two value attribute Initial_cost and Initial_retail.
Dynamically i am multiplying these values with required quantity and results are displayed in total_cost and total_retail.
Note: The Initial Cost and initial retail are accessed with a unique product id
Then these records are collected by value node up to required entries and are displayed in a table in other view.
Now my issue is to update the existing record (say product id 001 ). When i try to update record it replaces old record with new one but not gets updated.
Please help.(provide if any sample code availabe)
Mandeep Virk
Hi,
Apply the following code for ur table node
IPrivate<YourView>.I<urNode> gnode=wdContext.node<urnode>;
IPrivate<urView>.I<Element for that node> gelement=gnode.create<urElement>;
int ls=gnode.getLeadSelection();
gelement=gnode.get<urElement>ElementAt(ls);
gelement.setTotal_cost(initial_cost*quantity);
gelement.setTotal_retail(initial_retail*quantity);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mandeep,
I didnt get exactly wht you mean by replaced but not updated. But to my understanding.
If you already have records in the Context bound to table, say TableNode, then you just have to say
for(int i=0;i<wdContext.nodeTableNode().size();i++){
ITableNodeElement element =
wdContext.nodeTableNode().getTableNodeElementAt(i);
int value = element.getProductID();
if(value == 001){ // or variable holding value
wdContext.nodeTableNode().getTableNodeElementAt(i).setInitial_cost(20);
}
}
This will affect only that column record and not other columsn pertaining to row with product id 001. If you want the total_cost and total_retail to be updated automatically also, then add the value attribute for total_retail and total_cost in same tableNode and set the Calculated context property to True.
In the Corresponding calculated attribute method, write the Multiplication logic. This way, as soon as the node is modified , the correspnding calculated method is called and updated.
If this doesnt help. It would be good for us to help if you can give more details on the issue you are facing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shabir
Thanks for reply
Here i am doing application where i have to receive goods.
Suppose i received a good of unique product id and enter the quantity of goods received. This will multiply qty with initial and retail cost and give result as total cost and total retail.
Similarly i added few more goods which are collected by table node.
Again if i receive a good of same product id then quantity of those goods must be updated
eg
1) qty = 2 pcs * 1 (initial cost) = 2 Rs
5 (retail cost) = 10 Rs
2) ....
3).....
and again product one is received having qty = 5,
now i need to add this quantity with previous qty = 2 which make total qty = 7 and then calculate total costs.
In my case qty = 2 is being replaced by qty = 5, not being updated.
hope this will make u understand.
Regards,
Mandeep Virk
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
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.