| | | StrataFrame Beginner
       
Group: StrataFrame Users Last Login: 2 days ago @ 2:23:16 AM Posts: 12, Visits: 45 |
| | Hi to all, I'm new to StrataFrame (just done tutorials) and now I'm trying to port a little Powerbuilder application to .NET using StrataFrame before I decide to buy the framework. I have already done the basic maintenance forms for all the entities who maps 1 to 1 with database tables. Now I will try to create a more complex BO. I have a category table that represents a tree structure. Every row in the table has a parentId field pointing to his parent category. What I want to do is creating the BO and creates a maintenance form that displays a tree view with the categories and allows editing the selected one. Are there some samples for using such a structure? Recommendations? A lot of thanks, Alex Bibiano |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Today @ 11:13:06 AM Posts: 4,104, Visits: 4,176 |
| Are there some samples for using such a structure? Recommendations? This is a pretty common task...in fact, even as I stopped to write this post I was writing a maintenance form that has a tree structure. From what I can tell, you may want to incorporate several things. First, you would want to create a Enum that represents the type of record. Enums are great tools and you can see how to strong-type this value on your BO in the CRM Sample and the Customers BO. There is a field called cust_PhoneDatType and cust_PhoneNightType. This will show you how to strong-type a BO field property as an Enum...this is also shown in a number of other posts and in the help docs. Next, you would have a foreign key field that points back to itself. For example: Public Enum MyNodes As Integer Folder = 0 Report = 1 SubReport = 2 End Enum Then your data structures may look like this: Category Table cat_pk - Integer - Primary Key cat_cat_Parent - Foreign key back to this table for a child item. Leave zero for a parent record. cat_Type - Integer (Assign the MyNodes Enum to this value in the BO Mapper) cat_Name - VarChar - The name of the category At thsi point, just create your BO, map it to your structures and then add a customization to the cat_Type field for your MyNodes enum as mentioned above. Then you will create a fill method to property order these records and then load a tree view. That should really be about it.  |
| |
|
|