A change in the behaviour of MyBO.Save()


Author
Message
Peter Denton
Peter Denton
StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)
Group: Forum Members
Posts: 77, Visits: 787
G'day

I've just spent a considerable amount of time debugging a form that wasn't working. I finally tracked it down to the following code:

If Me.BoGRS1.MoveFirst Then

  Do

    Me.BoGRS1.GRSNew = False

    Me.BoGRS1.Save()

  Loop While Me.BoGRS1.MoveNext

End If

This just loops continuously. Once I found it, I very easily fixed it as follows:

If Me.BoGRS1.MoveFirst Then

  Do

    Me.BoGRS1.GRSNew = False

  Loop While Me.BoGRS1.MoveNext

  Me.BoGRS1.Save()

End If

This is much better anyway, and I've checked our codebase to ensure there were no other instances of the former method.

The reason I'm raising this is that this form had been working (although I'm unsure how recently), the code had been as I found it at least since the start of November 2007 (I haven't checked back any further), and the code would have been executed every time the form was used. The only change that I can relate it to is an update to VS2008 and SF 1.6.5. I'm wondering if this is a deliberate change in behaviour of Save(), an accidental change in behaviour, or behaviour that was always expected and my code used to work by some strage quirk of fate.

I thought you might be interested.

Peter

Replies
Peter Denton
Peter Denton
StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)
Group: Forum Members
Posts: 77, Visits: 787
Another situation has arisen, which is slightly related to GetEnumerable vs MoveFirst/MoveNext that I would like your advice on.

We have a ParentBO and ChildBO both on the same form in separate grids with the Parent/Child relationship set up so that the Grid displaying the ChildBO only shows those rows related to the Row selected in the Grid Showing the ParentBO (all good so far). Now what we need to do is to process through rows displayed on the ChildBO Grid.

We thought that we could process through the ChildBO using the techniques we've been discussing, because we thought the Parent/Child relationship filtered the ChildBO datatable to give a CurrentView that just has the rows displayed. However we noticed the processing was not behaving as expected and then discovered that the CurrentDataTable and the CurrentView were the same (no filtering). What should we do in this instance?

Peter

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Can you enlighten me please?

All BO methods, including the GetEnumerable, use the CurrentView which respects the fitlers, sorts, etc.  Another nice thing about the GetEnumerable is that it saves of the CurrentRowIndex and resets it for you as well, saving you a little work here.

However we noticed the processing was not behaving as expected and then discovered that the CurrentDataTable and the CurrentView were the same (no filtering). What should we do in this instance?

I guess I don't totally understand what you are trying to do here in the area of the filter.  So let me just explain how the filter actually works.  When you set the Filter property on the BO, it is actually setting the CurrentDataTable.DefaultView, and the CurrentView is just exposes the CurrentDataTable.DefaultView.  So the only way that they would be the same is if 1.) the filter applied includes all records 2.) no filter is applied.

Let me know if this is not going down the right direction.

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