StrataFrame Forum

BO-Movenext and Edit

http://forum.strataframe.net/Topic32193.aspx

By Thomas Holste - 9/10/2013

Hi there,

I am looping through a file:



BestBo1.moveNext()

   If BestBo1.Formatiert    ' Logical Field

      Me.doldsabfrage(oLDS)   ' Do an online-query

   Endif

Loop while BestBO1.movenext



in the follwong sub "doldsabfrage" something strange happens. If the online-rrequest ist succesful,

I do this:



lRet = olds.dorequest()

if lRet

   BestBO!.Edit()

... Assign some fileds

   BestBO!.Save()

Endif



Strange is (at least for me, that I do not loop through the file but always return to the first record.

I looked at it in the debigger and I can see that after the first loop, the next record is selected, but after

issuimg the edit command, the BO is positioned back to the first record.

What am I missing here?

Thanks in Advance

Thomas
By StrataFrame Team - 9/11/2013

So, after the call to Edit(), the CurrentRowIndex is back to 0?

My guess would be that AutoNavigateToFirstBrokenRow is turned on, the first row has a broken rule, and it's moving to it instead of staying on the current record when Edit() is called.  Try setting AutoNavigateToFirstBrokenRow to false and see if that fixes it.
By Thomas Holste - 9/12/2013

Hi Ben,

I changed AutoNavigateToFirstBrokenRow to False but the behaviour has not changed.

I helped myself by calling the edit method before the loop ans saving after the loop, which works

but I would still like to know what is going wrong there.

Best regards

Thomas
By Edhy Rijo - 9/13/2013

Hi Thomas,
  • You don't need to call the BestBO1.Edit() in your doldsabfrage() method, because once you assign a value to the record, it will place the BO in Edit mode.
  • After the loop, check if the BestBO1.IsDirty and then save it.
  • Also sometimes instead of looping with a Loop While, if possible try using the BestBO1.GetEnumerable()