BO.Add doesn't FilterChildRecords


Author
Message
Chan
Chan
Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I found that, BOAdd() doesn't filter child record. Is it by design?

I also found that, previously BO.Add() will call navigate() method which will also FilterChildRecords. However, it is remarked and replace with ForceNavigatedAndBoundRefresh() which doesn't filterchildrecords.



Please advice. Personally, I think Add() should auto filterchildrecords as well.



Thank you
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
Yes, by design.  If you look around the forum you will see that this has been a common topic in the past.  Generally from people having navigation issues because a filter is applied, a new record is added, and then the new record is not the current index.

The filter is respected on the add, but if you add a new record, you must set the columns that are part of the filter in order for the new record to show up where you expect it to be.  This is why we always recommend removing the filter prior to an add, set the columns that are part of the filter, then re-apply the filter.

Chan
Chan
Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I still not get it. Shall you explain in more details?

If I manually call FilterChildRecords() after call Add(), would it cause any issue?



Thank you
Dustin Taylor
Dustin Taylor
StrataFrame Team Member (660 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
Trent's point is that things can get confusing when you try to add a record with a filter applied. His suggestion is to:

1) Remove the filter on the BO before adding a record. i.e. BusinessObject.Filter = ""

2) Add the record

3) Re-apply the filter after the record is saved. i.e. BusinessObject.Filter = "<Your filter here>"

If you then have a child filter record you need to re-apply, then yes, you would do it after the add. But when adding any child records, I would still recommend removing the filter from the child BOs before performing the add.

Chan
Chan
Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I think I used to face the problem whereby, the newly added child record, would be missing. it happens if AutoIncrement approach used to generate PK value. Is it the originally problem?



If so, Guid assignment in SetDefaultValues() should not cause the problem .. even though I call FilterCHildRecords() after ParentBO.Add(), am I right?



Thank you
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
Is it the originally problem?

No.  And I will throw your next question in here as well, a GUID would not resolve the problem.  The problem is that if a filter is applied, let's say on a foreign key contraint, and a new record is added to the child BO, that new record will be immediately hidden the instant that it is created because of that filter.  This is just how ADO.NET views work.  So in order to get around this problem, remove the filter, add the child record and set the default values (i.e. the foreign key contraint column) and then reapply the filter and you will be OK.

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