BO-Count and number of records processed


Author
Message
Thomas Holste
Thomas Holste
StrataFrame User (370 reputation)StrataFrame User (370 reputation)StrataFrame User (370 reputation)StrataFrame User (370 reputation)StrataFrame User (370 reputation)StrataFrame User (370 reputation)StrataFrame User (370 reputation)StrataFrame User (370 reputation)StrataFrame User (370 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi there,

in a form I send data to wholesalers and have a property to check if the upload has worked. I call a sub-routine to process the data:



Private sub copydata(lSendenok as boolean)

BestBO1.Filter = "status = 'L'"

BestBO1.MoveFirst()

If lSendenOk Then

  ... Not yet tested

Else

   Dim nCount As Integer = 0 ' For testing

   Do

      BestBO1.STATUS = "W"

      nCount = nCount + 1  ' For testing

   Loop While BestBO1.MoveNext

   BestBO1.Save()

   MsgBox(nCount.ToString) ' For testing

Endif



At the beginning of the sub, after setting the filter-property, the bestbo1.count is 28 which are 28 records to be processed, but the Do-Loop runs only 14 times.  What may I have missed there?

Thanks in Advance

Thomas
StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You're filtering down to only those records that have a status of 'L'.  When you set the status to 'W', it removes the item from the view, so moves to the next record.  Like this:

Record1 Status L <-- Current row
Record2 Status L
Record3 Status L
Record4 Status L

Start of loop sets Record1 to Status W, and it gets filtered out:

Record2 Status L <-- Current row
Record3 Status L
Record4 Status L

Calling move next then moves to record 3, essentially skipping Record2

Record2 Status L
Record3 Status L <-- Current row
Record4 Status L

So, each time you change the status, you're changing the record and moving your pointer to the next record by removing the item from the filtered objects.  If you change your loop to Do While BestBO1.Count > 0, then, as you set the status to 'W', they will be removed from the filter, and you'll be able to get to all 28 records.
Thomas Holste
Thomas Holste
StrataFrame User (370 reputation)StrataFrame User (370 reputation)StrataFrame User (370 reputation)StrataFrame User (370 reputation)StrataFrame User (370 reputation)StrataFrame User (370 reputation)StrataFrame User (370 reputation)StrataFrame User (370 reputation)StrataFrame User (370 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ben,

thanks a lot, now it works fine.

Best regards

Thomas
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search