BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Automated N/W Diagram from mySQL database - solutions?

Started by ChapterNZ, April 06, 2011, 12:06:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Hi All,

I'm relativly new to visio so go easy on me if there is a simple solution to this.

Does anyone know a way to automate a diagram drawing for visio from an sql db (with 1200+ hardware items listed).
I've been playing around with the datalinking etc, But can't seem to find a way to generate a drawing from an sql db.

One of the rows in the db has a "object type" field, which lists the type of switch, ap etc..
Would be nice if I could pre-define the object type number to a certain symbol and when the diagram generates, it uses the associated symbol..

Thanks for any help,
I'll be working on this one for a while it seems.
The reason I want to try this out is I would like to have a single management point for my network. (The sql DB)



I was in a similar position sometime back, know how you feel.
I linked  the MSvisio interface to a MSaccess database. Look for Macros ->addons-> database wizard ...thereafter you need to create custom macros within the VBA visio environment to extract your databased information and then manipulate the result as a shape on the page.

Shapes will ultimatley be stencils that you can create yourself or use whatever Visio's stencils can deliver. Automated drawings are the pinnacle of the macro artist.. depending on the complexity and consistency of the targetted goal.


An intro to some of the basics (reading databases and drawing) is over here that uses VBA.

Some VB.NET examples are introduced over here that go a lot deeper

If you've got more questions, come on back.




Thanks very much for the replies and suggestions! I've had a good look/play around today..
This all seems extreamely complicated for the task so I think I will opt to do the placement of the diagram myself to skip this stage.
And there will only be 5-10 additions per week so I can just add these in once per month.

A couple of questions related to this however,

I have a UnitTypeID field in my database,
Can I link this UnitTypeID somehow, so when I click and drag a record from my database linked table, it will automactilly choose the correct symbol related to this UnitTypeID?

I have an ID field and a MasterID field in my database,
ID = primary key field + ID of the unit.
MasterID = showing what main unit (designated by ID) the unit is connected to.
Is there a function to automatically connect a shape I drag onto my diagram to its MasterID?   -   Also, when this is updated in the database, it would be nice if the connector would move also.. (I'm guessing thats starting to go back to the whole making macros etc.. so it might not be worth it for me..)


Short answers
1. When dragging a record onto the page it has to link to a pre-existing shape, Visio doesn't examine the record.
2. No, there isn't an autoconnect based upon data


when linking a shape to a table in the database.. I found that you can link various attributes of the shape (line thickness,linecolour, etc, even text) to fields within your database tables... also if you use the database addon "database refresh", when the underlying databse field values alter .. you simply refresh the Visio page and any shape attributes that are linked to the underlying database information will automatically alter..

example: create a box and use the database wizard to link to your table .. you will get the opportunity to link certain attributes of the shape to certain fields in the table.. one of which maybe contain a string "abc".. link the string field in the table to the text of the shape.. when the "abc" entry alters in the table to per se, "xyz".. activate the database refresh in Visio (refresh page) and the text name of the box will change from "abc" to to "xyz"..

try the help search index in Visio, to learn about the refresh page and database wizard

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 228 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1081KB.
Tokens: post-login.
Cache hits: 13: 0.00119s for 26,767 bytes (show)
Cache misses: 2: (show)
Queries used: 15.

[Show Queries]