Deleting Record from a BO


Author
Message
Scott
Scott
StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)
Group: Forum Members
Posts: 176, Visits: 1.5K
I have a BO filled with 3 records.  I am navigating thru the records with the following logic:

bo.fill();
if (bo.MoveFirst())
   do
   {
       bo.DeleteCurrentRow();
   } while(bo.MoveNext());

One record is always skipped becuase when the first record is delete the currentrow index is decreased to -1 then the bo is navigated which sets the currentrow to 0, when the call to MoveNext is made currentrow is increated to 1 there by skipping the second record in the table.

Being from a FoxPro background I was looking at this structure as a replacement for the SCAN ENDSCAN construct.  I can see that it would work for looping thru records easily but what do you recommend when looping and doing deletes?  I was thinking of just using

while(bo.count > 0)

I just wanted to point this out so that other FoxPro converts don't run into the same issue and not even realize it.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Scott - 19 Years Ago
Scott - 19 Years Ago
StrataFrame Team - 19 Years Ago
                 Good idea. I like that. Thanks for the confirmation.
Scott - 19 Years Ago
                     No problem :)
StrataFrame Team - 19 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search