ChildAutoFilter, what I'm missing?


Author
Message
Malcon
Malcon
StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)
Group: Forum Members
Posts: 28, Visits: 93
Follow the steps in the manual strata, but I can not do BO automatically filter the data through the property ChildAutoFilter. I used the base StrataFrameSample for testing, with the tables Orders and OrdersItens;
Did the relationship between the BO boOrdersItens, check the ChildAutoFilter boOrders when he brought the two MOBs for my application, the MARQUIER ParentBusiness of boOrdersItens with boOrders.
When I surf the boOrders, it should not automatically filter the boOrdersItens?
I'm putting my application attached.
Attachments
WindowsApplication1.rar (120 views, 88.00 KB)
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Malcon,

First, I am not a C# developer, so if my code is not correct, please use it as starting point BigGrin

The ChildAutoFilter is not very reliable, do a search in the forums and read about it.  Now, in your sample you are not getting the data for the child BO (boOrdersItens), at any rate you are always responsible to get the data into your BO so you can use the BO's functionality.

To make it easy and workable I did the following: 
  1. Reset the ChildAutoFilterOption to Off
  2. Created a boOrders_Navigated event and put the code to fill the child BO as follow:

  private void boOrders_Navigated(MicroFour.StrataFrame.Business.NavigatedEventArgs e)
  {
        if (boOrders.Count > 0)
        {
            boOrdersItens.FillByParentPrimaryKey(boOrders.or_pk);
        }
   }

Your sample should now work and will give you the hints you need to know why it was not working.  Remember, you are responsible to get the data into the BOs.

Edhy Rijo

Edited 14 Years Ago by Greg McGuffey
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Edhy's suggestion is excellent. One of the issues using the ChildFilterOption is that you must fill both the parent BO and the child BO will all available records for it to work. This is OK for small data sets, but not so good if you have lots of data. I almost always use the method Edhy is suggesting: get the child data when the parent is record is being viewed. 

Also, you probably want to also clear the child BO if for some reason the parent BO is empty. To expand on Edhy's code:

private void boOrders_Navigated(MicroFour.StrataFrame.Business.NavigatedEventArgs e)
  {
        if (boOrders.Count > 0)
        {
            boOrdersItens.FillByParentPrimaryKey(boOrders.or_pk);
        }
        else
        { 
            //-- Clear if parent BO is empty.
            boOrdersItens.Clear(); 
        }
   }


Malcon
Malcon
StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)
Group: Forum Members
Posts: 28, Visits: 93
Thanks Odhy and Greg.
My application is exactly as you told me. I use to navigate the parent BO navigate the child. But how has this possibility strataframe navigation automatically thought it would be more correct.
Which does not agree is that I have to fill all the BO son to navigate it properly. He should get the bank records only need the parent BO
Malcon
Malcon
StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)
Group: Forum Members
Posts: 28, Visits: 93
Ivan, voce poderia me dar uma ajuda com essa duvida? O strata nao deveria ir buscar automaticamente os dados no banco, sem eu ter de executar um methodo de pesquisa como filldatatable() ou FillAll()?
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Malcon (10/4/2010)
Thanks Odhy and Greg.
He should get the bank records only need the parent BO


Malcon,

You have total control on how you want your application to behave.  If you want the above, then fill the child BO using the FillByParent method instead, but like everything else, use common sense to place your FillBy commands so in this sample, the FillByParent should be after the boOrders.FillAll().

Keep in mind that this is just a sample to get ideas, in a real application it could take a lot of time to fill all records by parent, and mostly for the child.  The StrataFlix sample uses another method which is more efficient by getting all the data needed in single trip to the database.

Hope this help you understand the issue.

Edhy Rijo

Malcon
Malcon
StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)
Group: Forum Members
Posts: 28, Visits: 93
Edhy, now you left me with more doubts ...
I understand that if I use a FillAll () on all my tables had been slow, but I would like to automate the process of navigation. Would not want to do more of the filter Bo Bo navigate the Child Parent. In strataflix example, when there is the search for parent BO, Bo automatically all children will be filtered.
In the simple example I did, I would like the strata only search the data of BoOrderItesn, if I need to perform any kind of filter. We saw examples of strata that is possible, but I could not reproduce the same.
To summarize the whole topic: How to perform strataframe fill (or rowMach ou cascate) BOs in children?
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Malcon (10/4/2010)
Edhy, now you left me with more doubts ...


Sorry about the doubts, but believe it me, it is very simple and easy.

Again, you are responsible for loading the data.  SF has some predefined methods like FillByParent or FillByParentPK which will help you filter out the data, but how and when to use those is up to the developer to code.

In your sample you where not getting the data for the child bo, then nothing was shown (that makes perfect sense).  I show you that using the ParentBO.Navigated, you can get the child data, or if you prefer to load them all at a single place, you can use the ChildBO.FillByParent(ParentBO), but again be aware that if you are loading a lot of records, that could slow down the form.

In the case of StrataFlix, this is a very unique logic because it is designed to show only one single record in the ParentBO, then it will load all child records for that parent record, but you will not be able to navigate the parent, since it is designed to only show a single parent record at a time.  It is just another approach, and you can mix and match all approaches based on your application's requirements.

Edhy Rijo

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Malcon (10/4/2010)
Ivan, voce poderia me dar uma ajuda com essa duvida? O strata nao deveria ir buscar automaticamente os dados no banco, sem eu ter de executar um methodo de pesquisa como filldatatable() ou FillAll()?


Hey Malcon!

Nope, SF is not supposed to go to the Database and automatically fetch the children records. As Edhy and Greg told you, the best approach to accomplish this, in you particular case, would be to use the Parent Navigated event and once this happened, go get the children. This is not a filter, it is a complete Fill for the child BO. So, every time your parent navigates, you get its children inside the child BO and you will be fine.

To get it filtered as you mentioned earlier, you would have to first fill your child BO with ALL records from the database, and then it would be filtered as the parent navigated. It can be done, but if this would be the best solution depends on your decisions.
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