on 04-26-2009 5:46 AM
Hi All,
in my application iam using two tables,
this is my code
int selection = wdContext.nodeA().getLeadSelection();
String num = wdContext.nodeA.geAAt(selection).getV_Num();
for(int b=0;b<wdContext.nodeVn_Context().size();b++)
{
if(wdContext.nodeVn_Context().getVn_ContextElementAt(b).getVa_num().equalsIgnoreCase
(num))
{
wdContext.nodeVn_Context().removeElement(wdContext.nodeVn_Context().getVn_ContextElementAt(b));
}
}
here Vn_Context is having 4 rows, i mean size of Vn_Context is 4. when i use this code to remove that 4 rows based on the condition, which i gave in if, its able to remove only one row, so how to remove those four rows, is this code correct or not, please help me.
dfs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for (int i = wdContext.node<Node>().size() - 1; i >=0; --i)
{
I<Node>Element e = wdContext.node<Node>().get<Node>ElementAt(i);
if ( condition_to_delete(e) )
wdContext.node<Node>().removeElement(e);
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi sushma,
if you have 4 row then why should you give the condition for removing rrow..because when you gave condition the depends on your lead selection of getVa_num().so you will return perticullar row of getVa_num(). value of lad selection ..this would not match of other row value(getVa_num().so it will remove only that value of lead selection of getVa_num().
better you remove taht condition.
int selection = wdContext.nodeA().getLeadSelection();
String num = wdContext.nodeA.geAAt(selection).getV_Num();
for(int b=0;b<wdContext.nodeVn_Context().size();b++)
{
//if(wdContext.nodeVn_Context().getVn_ContextElementAt(b).getVa_num().equalsIgnoreCase
//(num))
//{
wdContext.nodeVn_Context().removeElement(wdContext.nodeVn_Context().getVn_ContextElementAt(b));
//}
}
no need to give the condition right now..
if you want to remove multiselection row,i mean selected row for multiple then you select the row as per your rows delete.
for(int b=0;b<wdContext.nodeVn_Context().size();b++)
{
if(lead==b || wdcontext.nodeVn_Context().isMultiselection(b){
wdContext.nodeVn_Context().removeElement(wdContext.nodeVn_Context().getVn_ContextElementAt(b));
}
}
this way you do solve your problem..
thanks
jjati
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
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.