12 April, 2011

Maintain and Model your system configuration using Visio 2010

I’ve recently been presented with a system that had it’s system components (Bill Of Materials) modeled in Visio 2010. Actually, pretty clever setup as it gives the people responsible for the system configuration a tool that’s intuitive and pretty straight forward to use (i.e. Visio 2010). And might I add, this person does not have to be developer or some other person “burdened” with some deep technical knowledge (like yours truly ;-)).

Now, this situation gave me an idea about how you could extend this to also include other artifacts as well. Using the templates found in Visio 2010, you can easily create e.g. an Organization Chart (see example below).

Visio 2010 Organization Chart

Visio will support the user when creating this diagram, and data can even be retrieved/stored in a relational database if you so desire.

Well – this is grand. Now, how do you go about exporting this into some underlying technical system that can read this configuration (organization chart) and use it for runtime operation? Basically, I’m after the below scenario; to be allowed to “read” the Visio Chart programmatically.

Data flow

This actually turned out a lot easier than I feared. In Visio 2010, you can export data using the “Org Chart” menu + the “Export” button.

Export -> (excel, .txt, .csv)

This leaves you with 3 options:
1) Microsoft Excel workbook
2) Tab Delimited (.txt)
3) Comma Separated (.csv)

Choosing the last option (.csv), you gain a .csv file that looks like this. Note that the hierarchical information is present as well (via the ‘Reports_To’ column), so that e.g. ‘John Polik’ reports to ‘Eric Idle’.

CSV export file

Now – reading this text is as easy as using String.Split(‘,’) and you are good to go.

string[] splittedString = csvFileLine.Split(',');

 


Technorati Tags:

No comments: