Parent-Son-Garndson Listview


Author
Message
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
Gerard O Carroll (05/21/2009)
Is this the best way to do this




Yes, you want t run the List2.Requery() all the time so it can do just what is needed, show/remove records from the listview as per request.

Edhy Rijo

Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Putting in the List2.Requery() has got a little further. Thanks. Now, I can get the grandchildren to display.

I had a porblem displaying the grandchildren as I scrolled up and down the Listview. I played around with the AutonavigateToSelected property  and the Tag field, and this is working now also.... is this yhe purpose of  this propery  ?

The only issue I have right now is how to flush out the Grandchild List, if there are no grandchilden for a partcular son e,g, the following sequence A son with Grandchildren, the next son has no grandchildren. etc. I initially had a if BO1.Count > 0, but then this was not refreshing the Grandchildren , leaving the grandchildren from the previous record. If I took this If BO1.Count out, I got an error message.What I have ended up doing, which works, is as follows:

this.idE_BO1.FillByParentPrimaryKey(0);

if (this.itR_BO1.Count > 0)

{ this.idE_BO1.FillByParentPrimaryKey(this.itR_BO1.ITR_PK); }

this.listView2.Requery();

i.e. I have filled first with a zero value

Is this the best way to do this

 

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
In the code that you provided, I don't see anywhere that you call the ListView2.Requery(). It is hard looking at an example like this as there is not much to go on since you did not provide a full sample. If you have a sample that illustrates this that you could share then please post that as it would be easier to work with.



The reason I am not sure exactly where to direct you as I don't exactly understand where your issue is. Setting up a parent->child->grandchild and event deeper relationship is something that we work with on a daily basis...including within ListViews. So at this point I know that it is just a matter of configuration. But I am not sure exactly at which point you are having the issue.



From just looking at your code, I see one issue here:



private void itR_BO1_Navigated(MicroFour.StrataFrame.Business.NavigatedEventArgs e)

{



if (this.itR_BO1.Count > 0)

this.idE_BO1.FillByParentPrimaryKey(this.itR_BO1.ITR_PK);



}




You never call the listview2.Requery(). Based on my assumption of your code, shouldn't the code read:



private void itR_BO1_Navigated(MicroFour.StrataFrame.Business.NavigatedEventArgs e)

{



if (this.itR_BO1.Count > 0)

this.idE_BO1.FillByParentPrimaryKey(this.itR_BO1.ITR_PK);



listview2.Requery();

}

Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Still having a few issues with grandchildren on a listview. I more or less copied Edhy's suggestions to my own app , but grandchildren are still not displaying. I can navigate the Child ok ,but nothing is showing up on the Grand-child listview. It is also displaying an error if I double Click on any of the childen records on ListView 1. Screen attched. (It also shows up the error the first time I do a single click on one of the children records) . I am also attaching the code for the screen  (This uses similar structure to strataframe Sample with following BO names that I have used in my app ( Cust = SMA   Order=ITR  ORIT=IDE). The only other difference that I can see is that The Primary Key of My Customer File(SMA) is a string field rather than an int field .
Attachments
Ger1.zip (98 views, 93.00 KB)
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
Edhy, thanks for your detailed explanations and help.  I know that Gerard as well as other developers that may run into this into the future will greatly appreciate your efforts!

Gerard, hang in there.  You are making progress each week.  Before long this will all be second-hand! Wink

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
Gerard O Carroll (05/17/2009)
... I am just at that learning point on the curve where I reckon if I can get some concrete results on the next few weeks I will have made a lot of progress




Don't worry, you will do just fine, we all have been in the same spot sometime.



The listview is my favorite control, it has been enhanced to do many thing automatically. Read the Listview topic in the "UI Layer -> Controls -> ListView" help file.



I have some free time now, so here is a quick description of how to populate it: The ListView and the ComboBox uses the same type of population, they both have an internal BO to host their items. When you use the Population Type Editor, you can select any method to be executed to fill the internal BO or you can use the BO.CopyDataFrom() method which requires you to have a BO dropped on the form to fill the internal ListView/ComboBox BO, this is the way I prefer to setup ListView since usually you may want to do something else with the data in the ListView and it is easier to manipulate the data in a BO dropped in the form.



Using the BO.CopyDataFrom(BusinessLayerBase, BusinessCloneDataType) method, requires 2 parameters. In the ListView.ListPopulating event you have to assign the values for those 2 parameters, I use VB.NET, but in you case it will look like this:



private void listView1_ListPopulating(MicroFour.StrataFrame.UI.ListPopulatingEventArgs e)

{

e.Parameters[0].Value = this.oR_BO1;

e.Parameters[1].Value = MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromDefaultView;

}



This way, when you call the ListView.Requery() it will copy the data from the BO assigned in Parameters[0] with the required BusinessCloseDataType that you use, in most cases "ClearAndFillFromDefaultView".



Also pay attention to the "StrataFrame: User Interface Automation" properties you can use, in your case for the "Transactions" listview I used the "BusinessObject" and the "AutoNavigateToSelectedRecord" properties, this will have the effect that when you select any record in the ListView it will move the record pointer in the BO "oR_BO1" and trigger the oR_BO1.Navigated() event which will then requery the "Transactions Details" listview which has been in the same way as the "Transaction" listview.



Hope this give you and others a clear view of how the ListView/ComboBox population works. Check the references in the help file and also take a look at the StrataFlix sample which make use of the ListView and ComboBox in its own way. Also keep in mind that this is just one way to populate these controls, SF provide us with a great flexibility on how to populate these controls which you will find out once you get more familiar with the framework.


Edhy Rijo

Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Hi Edhy, many thanks for taking the time to unzip the app and having a look at it.

I have downloaded your zip, unzipped it and it runs fine.

I'll need some time to have a look at it in detail

I see you are using a BusinessCloneDataType.. not sure what that does but I'll have a closer look and see if I can sort out my own app with the help of your download.

Many thanks again for taking the time to look at this. I am just at that learning point on the curve where I reckon if I can get some concrete results on the next few weeks I will have made a lot of progress

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 Gerard,



Sorry I don't have time now to explain in detail, but I changed the logic of your sample (see attached projects). Look at the listviews population method and at the BOs Navigated events.



Your BO relation definitions are OK. You will see data from record 2.



Have a nice weekend! Tongue

Edhy Rijo

Attachments
KEK.zip (115 views, 203.00 KB)
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Have gone back over the app...cannot see where I am going wrong. So I have set up another SamplE App using StRata Frame sample Sql Server Database....am still having the same problem trying to see the grandchildren....I know this must be something very simple that I cannot just see.. I am uploading two projects

SF_Samppl_App which has just 1 form (frmCust) (KEK_1.ZIP)

SF_SAMPLE_BO which is a BO Library with Cust,Orders and Order Lines BO set up. (KEK_2.ZIP)

I'd really apprEciate it if someone could have a look

Attachments
KEK_1.ZIP (95 views, 97.00 KB)
KEK_2.ZIP (103 views, 102.00 KB)
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Hi Edhy.

I will go back over the app with a fine tooth comb..just thought that mabe I was missing ... some piece of code somewhere..if I still have issues, i'll do up a smple on SF database and post it

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