﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Tree structure for BO</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Mon, 08 Jun 2026 22:44:42 GMT</lastBuildDate><ttl>20</ttl><item><title>Tree structure for BO</title><link>http://forum.strataframe.net/FindPost14648.aspx</link><description>Hi to all,&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;I have already done the basic maintenance forms for all the entities who maps 1 to 1 with database tables.&lt;/P&gt;&lt;P&gt;Now I will try to create a more complex BO.&lt;/P&gt;&lt;P&gt;I have a category table that represents a tree structure. Every row in the table has a parentId field pointing to his parent category.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Are there some samples for using such a structure? Recommendations?&lt;/P&gt;&lt;P&gt;A lot of thanks,&lt;/P&gt;&lt;P&gt;Alex Bibiano</description><pubDate>Tue, 04 Mar 2008 11:17:18 GMT</pubDate><dc:creator>Alex Bibiano González</dc:creator></item><item><title>RE: Tree structure for BO</title><link>http://forum.strataframe.net/FindPost14649.aspx</link><description>[quote]Are there some samples for using such a structure? Recommendations?[/quote]&lt;/P&gt;&lt;P&gt;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.&amp;nbsp; From what I can tell, you may want to incorporate several things.&amp;nbsp; First, you would want to create a Enum that represents the type of record.&amp;nbsp; 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.&amp;nbsp; There is a field called cust_PhoneDatType and cust_PhoneNightType.&amp;nbsp; 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.&lt;/P&gt;&lt;P&gt;Next, you would have a foreign key field that points back to itself.&amp;nbsp; For example:&lt;/P&gt;&lt;P&gt;[codesnippet]Public Enum MyNodes As Integer&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Folder = 0&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Report = 1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SubReport = 2&lt;BR&gt;End Enum[/codesnippet]&lt;/P&gt;&lt;P&gt;Then your data structures may look like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Category Table&lt;BR&gt;&lt;/STRONG&gt;cat_pk - Integer - Primary Key&lt;BR&gt;cat_cat_Parent - Foreign key back to this table for a child item.&amp;nbsp; Leave zero for a parent record.&lt;BR&gt;cat_Type - Integer (Assign the MyNodes Enum to this value in the BO Mapper)&lt;BR&gt;cat_Name - VarChar - The name of the category&lt;/P&gt;&lt;P&gt;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.&amp;nbsp; Then you will create a fill method to property order these records and then load a tree view.&amp;nbsp; That should really be about it. :)</description><pubDate>Tue, 04 Mar 2008 11:17:18 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>