Move methods and filtering


Author
Message
Tim Dol
Tim Dol
StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
I'm not sure if I'm doing something wrong or discovered a small bug.

I have two related business objects on a form, Tasks and TaskPredecessors.  I'm using 'MatchCurrentRow' on the ChildFilterRowMethod.

I am executing a routine to populate the 'Tasks' BO based on data from a temporary business object.   Basically iterating through the temporary BO and creating new rows in the 'Tasks' BO.   This works fine.

Once this routine has completed, I need to populate the 'TaskPredecessors' based on information in the Tasks BO. Basically I am creating dependencies between the tasks.

I am using a similar approach of iterating the Tasks BO...If MoveFirst... MoveNext..  and creating new rows in the TaskPrecedessors BO, however I am getting an error on the NewRow  (Index 0 is either negative or above rows count).

I discovered that the Tasks filter property isn't changing as I iterate through the BO. The property holds the value of the last row from the initial population. 

Should the Move methods be changing the filter property according to the parent primary key?

Thanks,

Tim

Peter Denton
Peter Denton
StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)
Group: Forum Members
Posts: 77, Visits: 787
G'day

I believe that you may be missing the point of the parent child relationship between BOs (as I certainly did when I first started using them). If you have the parent child relationship set up in the child BO, you don't have to populate the child BO based on what you have just populated the parent BO with, you just populate it with everything and strataframe takes care of the filtering.

Peter

Tim Dol
Tim Dol
StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
I fully understand the parent / child concept.  The problem is the child records are not filtering correctly as I 'move' through the parent records. 
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
have two related business objects on a form, Tasks and TaskPredecessors.  I'm using 'MatchCurrentRow' on the ChildFilterRowMethod.

Hey, Tim.  A couple of things here.  I will see if I can reproduce as I don't think there is an issue here...so there could be something funny with the relationship or something long those lines.

However, I would try something and change one of your processes.  You can definitely use the Move methods...I still have code that uses them, but you might want to start using the GetEnumerable() method on the BO:

For Each bo As CustomersBO In MyCustomers.GetEnumerable()
 '-- You can then reference each row strong typed via the bo instance
 If bo.cust_LastName.Equals("SomeValue") Then
  '-- Do something else
        End If
Next

This method takes care of a lot of things for you such as saving off and restoring the current row index, etc.  Plus...it is faster, not massively, but every little bit counts Smile

Next, manually set the filter on the child to see if your issue is resolved.  This is generally what I do anyway because I end up leaving the AutoFitler on half the time and end up chasing my tail later when I add a new record and things get funky on me Smile

MyChildBo.Filter = "MyChildField = " & MyParentBO.FilterValueField

'-- Place your for loop or Move code here

'-- Don't forget to reset the filter

MyChildBo.Filter = ""

Try that and see if your problem goes away.  It will at least be a good starting point.

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