Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Access parent/child of tablenodes in a diagram (Read 1144 times)
newbieDraw
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Dec 22nd, 2011
Access parent/child of tablenodes in a diagram
Feb 16th, 2012 at 6:39am
Print Post  
Hi Stoyo,

I have seen the developer's guide and found some relevant information on accessing node hierarchy. I have some specific queries regarding that:
Using the code you sent yesterday, I am trying to get the node that has no parents (i.e. the Root node) and then start a tree traversal from that node (updating information at each level). Different branches may have different levels.
Presently I am testing to see if I can write the nodeID for the parent node to a text file, but haven't succeeded. Please have a look at the code below:

Code
Select All
StreamWriter sw = new StreamWriter("C:\\work\\bca_data.txt", true, Encoding.ASCII);


            foreach (DiagramNode node in diagram.Nodes)
            {
                TableNode table = node as TableNode;
                if (table == null)
                    continue;
                if (table.Query("inlinks/origin")==null)
                {
                    string parentstring = table.Caption.ToString() + "parent";
                    sw.WriteLine(parentstring);
                } 



Thanks,
...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Access parent/child of tablenodes in a diagram
Reply #1 - Feb 16th, 2012 at 7:14am
Print Post  
Hi,

I think Query will return an empty collection in this case. Check if the result's Count is equal to 0 to determine if this is the root table. You could also check table.GetAllIncomingLinks().Count.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint