StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Tree structure for BOExpand / Collapse
Author
Message
Posted 03/04/2008 11:09:56 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: StrataFrame Users
Last Login: 10/06/2008 2:34:36 PM
Posts: 12, Visits: 46
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

Post #14648
Posted 03/04/2008 11:17:18 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 4:52:53 AM
Posts: 4,586, Visits: 4,571
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.

Post #14649
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 8:17am

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.156. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.