<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Retrieving Data Based On A Hierachical Model</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : Retrieving Data Based On A Hierachical Model</description>
  <pubDate>Tue, 14 Apr 2026 16:29:27 -700</pubDate>
  <lastBuildDate>Tue, 31 Jul 2007 08:36:50 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=334</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Retrieving Data Based On A Hierachical Model : There are a couple of different...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=334&amp;PID=810#810</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=23" rel="nofollow">davidklitzke</a><br /><strong>Subject:</strong> 334<br /><strong>Posted:</strong> 31-Jul-2007 at 8:36am<br /><br /><P>There are a couple of different approaches you could use.&nbsp; You could either define a new property or override an existing property, or you could build an event handler to dynamically handle your problem, or both.</P><DIV>(1) Create a new property</DIV><DIV>&nbsp;</DIV><DIV>You could create a new property (e.g., "RestrictedEmployees" or "RestrictedEmployeeGraph") that would provide a ReadOnly EntityList or an EntityGraph of those employees that the current user had access to.</DIV><DIV>&nbsp;</DIV><DIV>(2) Override an existing property</DIV><DIV>&nbsp;</DIV><DIV>For example, the property Employee.DirectReports currently provides a ReadOnly list of all direct reports .&nbsp; You could override this property to provide the subset of Employees that should be visible to the user.&nbsp; You could also use an EntityGraph to capture a hierarchy of Employees.&nbsp; One advantage of an override is that this approach might be implemented with the least amount of code.</DIV><DIV>&nbsp;</DIV><DIV>(3) Use an event handler</DIV><DIV>&nbsp;</DIV><DIV>You could use an event (e.g., button click, or double-click on a row in the grid) and then provide an event handler to dynamically process the event.&nbsp; For example, it could discover the currently selected Employee, and then compute the list of Employees that could be seen.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Tue, 31 Jul 2007 08:36:50 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=334&amp;PID=810#810</guid>
  </item> 
  <item>
   <title>Retrieving Data Based On A Hierachical Model : Well.... that kinda doesn&amp;#039;t...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=334&amp;PID=793#793</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=77" rel="nofollow">jozza</a><br /><strong>Subject:</strong> 334<br /><strong>Posted:</strong> 29-Jul-2007 at 4:30pm<br /><br />Well.... that kinda doesn't really answer my question. I'm aware that you can use navigation to view "direct reports" but my question is about how you can restrict navigation. ie. Only allow the user to navigate down certain direct reports based on say, some security setting. <DIV>&nbsp;</DIV><DIV>So in your example the foreach statement only has a subset of Tracy's direct reports in Tracy.DirectReports.</DIV><DIV>&nbsp;</DIV><DIV>Thanks.</DIV>]]>
   </description>
   <pubDate>Sun, 29 Jul 2007 16:30:11 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=334&amp;PID=793#793</guid>
  </item> 
  <item>
   <title>Retrieving Data Based On A Hierachical Model : This is a good example of where...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=334&amp;PID=788#788</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=21" rel="nofollow">IdeaBlade</a><br /><strong>Subject:</strong> 334<br /><strong>Posted:</strong> 27-Jul-2007 at 11:17am<br /><br />This is a good example of where you want to use "navigation", not a "query".&nbsp; Developers new to DevForce often think they should obtain business objects using a query whereas in practice navigation often works much better.<DIV>&nbsp;</DIV><DIV>For my example, I use the IdeaBladeTutorial Datababase, and assume that all individuals belong to the Employee table.&nbsp; The name of the relationship for "Boss" is "Manager.&nbsp; The name of the relationship for "direct reports" is "DirectReports".&nbsp; See IdeaBlade Tutorial on "Populating a WinForm" for concrete examples.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>Example -&nbsp;&nbsp;Print out all of Tracy's direct reports and her manager &nbsp;by:</DIV><DIV>&nbsp;</DIV><DIV><FONT size=2></FONT><FONT color=#2b91af size=2><FONT size=2><P></FONT><FONT color=#2b91af size=2>PrimaryKey</FONT><FONT size=2> key = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> </FONT><FONT color=#2b91af size=2>PrimaryKey</FONT><FONT size=2>(</FONT><FONT color=#0000ff size=2>typeof</FONT><FONT size=2>(</FONT><FONT color=#2b91af size=2>Employee</FONT><FONT size=2>), 6);</P><P></FONT><FONT color=#2b91af size=2>Employee</FONT><FONT size=2> Tracy = (</FONT><FONT color=#2b91af size=2>Employee</FONT><FONT size=2>)mPM.GetEntity(key);</P><P></FONT><FONT color=#0000ff size=2>foreach</FONT><FONT size=2> (</FONT><FONT color=#2b91af size=2>Employee</FONT><FONT size=2> emp </FONT><FONT color=#0000ff size=2>in</FONT><FONT size=2> Tracy.DirectReports) {</P><P></FONT><FONT color=#2b91af size=2>MessageBox</FONT><FONT size=2>.Show(emp.FullName);</P><DIV><FONT color=#2b91af size=2>}</FONT></DIV><DIV><FONT color=#2b91af size=2></FONT>&nbsp;</DIV><DIV><FONT color=#2b91af size=2>MessageBox</FONT><FONT size=2><FONT color=#000000>.Show(Tracy.Manager.FullName);</DIV><DIV><DIV></FONT></FONT></FONT></FONT>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV></DIV></DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Fri, 27 Jul 2007 11:17:13 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=334&amp;PID=788#788</guid>
  </item> 
  <item>
   <title>Retrieving Data Based On A Hierachical Model : Hi,  Say for example I have...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=334&amp;PID=782#782</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=77" rel="nofollow">jozza</a><br /><strong>Subject:</strong> 334<br /><strong>Posted:</strong> 26-Jul-2007 at 11:47pm<br /><br />Hi,<DIV>&nbsp;</DIV><DIV>Say for example I have a hierarchical table as follows:</DIV><DIV>&nbsp;</DIV><DIV>Id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Parent</DIV><DIV>1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Bob&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL</DIV><DIV>2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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nbsp; 6</DIV><DIV>10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sue&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6</DIV><DIV>11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Boris&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8</DIV><DIV>&nbsp;</DIV><DIV>So we have a hierarchy which is n levels deep. Where for example, Tracy's boss is Steve and Tracy has Trevor, Reginald, Sue underneath her as direct reports and Boris as an indirect report.</DIV><DIV>&nbsp;</DIV><DIV>No I'd like to create a query that given an Id, will return all the reports for the given person as well as being able to reference their bosses, but at the sametime not allowing to traverse back down the tree from the boss level. Let me give an example to make this clear.</DIV><DIV>&nbsp;</DIV><DIV>Say we pass in 6 (Tracy)&nbsp;to the query i want to get back Trevor, Reginald and Sue, so basically Tracy.Reports.Count = 3. I should also be able to go Tracy.Reports&#091;Trevor&#093;.Reports.Count = 1. Excuse the invalid syntax, but it gives you an idea of what i'm getting at. ie. being able to traverse down the tree. Also, I'd like to be able to go Tracy.Boss which returns Steve. Now that i have the Steve entity object i want to be able to only traverse back down the Tracy path. ie. I shouldn't be allowed to go Steve.Reports&#091;Sally&#093;, because Sally wasn't in the result of the original query. I hope that makes sense.</DIV><DIV>&nbsp;</DIV><DIV>Thanks.</DIV>]]>
   </description>
   <pubDate>Thu, 26 Jul 2007 23:47:47 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=334&amp;PID=782#782</guid>
  </item> 
 </channel>
</rss>