on 08-14-2006 3:08 PM
Hi everyone,
I have a strange problem regarding a loop.
I have a node which has 8784 lines.
I created an inputfield in the view thus the user can insert a string and an algorithm performs a search for him (displaying what he want in the table).
Here is the code :
IEt_Emp_Resp_TmpNode node = wdContext.nodeEt_Emp_Resp_Tmp();
int i=0;
wdComponentAPI.getMessageManager().reportSuccess("node.size() == " + node.size());
for(i=0; i<node.size(); i++)
{
IEt_Emp_Resp_TmpElement e = node.getEt_Emp_Resp_TmpElementAt(i);
if (! e.getPernr().equals(text))
{
node.removeElement(e);
}
}
wdComponentAPI.getMessageManager().reportSuccess(">> " + i);
The problem is the loop doesn't go till 8784 but stops at
4393.
Can someone help ?
Thanks.
David,
When removing elements, loop in reverse direction:
for(i = node.size() - 1; i>=0; i--) {
...
}
Valery Silaev
EPAM Systems
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
Your for condition is incorrect. Try
for (int i = node.size() - 1; i >= 0; i--)
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.