on 09-18-2014 7:40 PM
I try to go through datawndow rows by for loop and delete those rows I found with condition. Something like:
For i = 1 to dw_1.RowCount()
....
if expression then
dw_1.DeleteRow(i)
end if
Next
Looks like not working properly. if DeleteRow dynamically change RowCount()? how to resolve this problem?
HI Kent;
Suggestion: Try it in reverse ....
Long ll_max
ll_max = dw_1.RowCount()
For i = ll_max to 1 STEP -1
....
if expression then
dw_1.DeleteRow(i)
end if
Next
HTH
Regards ... Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kent,
You could apply a filter with you expression, then move rows to delete buffer and remove the filter:
dw_1.SetFilter ( expression )
dw_1.Filter()
dw_1,RowsMove ( 1, dw_1.RowCount () , Primary! , dw_1, 1, Delete! )
dw_1.SetFilter ('')
dw_1.Filter()
dw_1.Sort()
Just a thought
Lars
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you must go from row 1 to RowCount(), then try this:
long ll_Row
ll_Row = 1
DO WHILE ll_Row <= dw_1.RowCount()
....
IF expression THEN
dw_1.DeleteRow(ll_Row)
ELSE
ll_Row++
END IF
LOOP
HTH,
Manuel Marte
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To iterate from the last to the first row will do the trick:
long i
For i = dw_1.RowCount() To 1 Step -1
...
If ( expression ) Then
dw_1.DeleteRow ( i )
End If
Next
hth
Arnd
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you don't need to delete the records in a specific order, try this:
ll_Row = dw_1.RowCount()
FOR i = ll_Row TO 1 STEP -1
....
IF expression THEN
dw_1.DeleteRow(i)
END IF
NEXT
HTH,
Manuel Marte
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.