The Challenge

Generate an Organization chart

Given this input data


Corticon analyzes the relationships between the users and generates code that can be used by a program called Graphviz to draw the picture ( ) Incidentally this is the same program that is used internally by Studio to draw the rule dependency diagram and the execution sequence diagram.

The Vocabulary

Note that the vocab has a recursive relationship because any user may have both managers and subordinates

Rule Flow

Assemble Org Chart

The end result of this is that the Chart.text  will be populated with the Graphviz expression to generate an organization chart.

Test Case

This is what it looks like:

strict digraph U {size="15,15";node [fontname = "Bitstream Vera Sans" fontsize = 8 shape = "record" ];  edge [fontname = "Bitstream Vera Sans" fontsize = 8 ]; Akama->Komazawa;Akama->Yamagata;Komazawa->Kurosawa;Kurosawa->Mifune;Indo->Hosokawa;Indo->Yokokawa;Indo->Horigome;Indo->Nakamura;Indo->Yamada;Yokokawa->Akama;Yokokawa->Oi;Yokokawa->Hata;}


Generating the Diagram

In my Corticon Studio I have a couple of extended operators that can export this code and run the Graphviz program to generate the picture. If you try running the rule above you probably won’t have my extended operators.

However you can still draw the pictures as follows:

  1. Download and install Graphviz (it’s free)
  2. Start Graphviz
  3. Copy/paste the string for the chart into Graphviz
  4. Run graphviz


Automating the Entire process

If you want to add functionality to Studio to generate the picture for you here’s what you will need to do:

  1. Read the documentation on creating extended operators
  2. Create two operators
    1. WRITEFILE – to write the chart string to a text file
    2. RUNCOMMAND – to run any command
  3. Add a rule sheet like the one below

The entity called ExtendedOperator simply provides a result attribute that can be assigned when the extended operator is executed.

You will also need to write these operators in Java.

Here’s how I implemented them


I use the return value to indicate success or failure.


As you can see the java code is not complex.


But you will have to package these operators so they can be accessed by Studio.

That topic is a bit outside this article but is covered in the Corticon documentation.

When you are done your extended operators will show up something like this:

Where did the Data Come from?

Of course you could hand type all the user information into the tester in order to generate an Org Chart.

But a much easier way is to use Corticon Enterprise Data Connector to read that data directly from Sales Force.

This just requires specifying the appropriate DataDirect URL in the vocabulary.

For more information on DataDirect see: