Jump to content

This topic is 3373 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Just wanted to share with everyone that there is a great way to visualize tree-like structures, using GraphViz (GraphViz.org), which is an open source command line tool.  Basically, I have FileMaker create a text file indicating the nodes in the tree (corresponding to records), and the edges among the tree (corresponding to relationships).

 

For Mac users, the Mountain Lion version you can download at the web site also works for Mavericks; I'll be testing it to make sure it works with Yosemite, too.

 

You have a script generate the text file (I have a recursive script that goes to each child, until a record is reached that doesn't have children), and then call the GraphViz program via the command

 

dot tree.txt -Tpng -o visual.png

 

I think you can specify PDF, JPG, etc., in lieu of PNG.

 

This problem has been vexing me for quite some time!  Once the file has been generated, you can then suck it back into FM, etc.  As a tip, you can set up a small AppleScript to "spin" until the file has been generated, so your script doesn't try to get the file before it's been created (although the creation process is essentially instananeous). 

 

As an example, my script generates this text file:

digraph DryjaPat {
DP1[label="9999.001US1nDocketTestNum1nn01/10/2000"] [shape=rectangle];
DP2[label="9999.001US2nDocketTestNum2nn03/15/2000"] [shape=rectangle];
DP1 -> DP2[dir=back][label=" continuation"];
DP3[label="9999.001US3nDocketTestNum3nn02/10/2000"] [shape=rectangle];
DP2 -> DP3[dir=back][label=" divisional"];
DP4[label="9999.001US4nDocketTestNum4nn01/15/2005"] [shape=rectangle];
DP2 -> DP4[dir=back][label=" divisional"];
DP5[label="9999.001US6nDocketNum6nn01/15/2007"] [shape=rectangle];
DP4 -> DP5[dir=back][label=" continuation"];
DP6[label="9999.001US7nDocketNum7nn01/15/2005"] [shape=rectangle];
DP4 -> DP6[dir=back][label=" CIP"];
DP7[label="9999.001US5nDocketNum5nn01/22/2003"] [shape=rectangle];
DP2 -> DP7[dir=back][label=" divisional"];
}

and then GraphViz generates this:

post-112239-0-66578900-1419011762_thumb.

Link to comment
Share on other sites

  • 3 weeks later...
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.