Author Topic: Automated N/W Diagram from mySQL database - solutions?  (Read 6459 times)

0 Members and 1 Guest are viewing this topic.

ChapterNZ

  • Newbie
  • *
  • Posts: 2
Automated N/W Diagram from mySQL database - solutions?
« on: April 05, 2011, 07:06:11 PM »
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.

Also,
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)



Cheers
« Last Edit: April 05, 2011, 07:25:22 PM by ChapterNZ »

cliff50

  • Full Member
  • ***
  • Posts: 213
Re: Automated N/W Diagram from mySQL database - solutions?
« Reply #1 on: April 06, 2011, 03:04:20 AM »
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.

aledlund

  • Hero Member
  • *****
  • Posts: 1412
Re: Automated N/W Diagram from mySQL database - solutions?
« Reply #2 on: April 06, 2011, 09:06:19 AM »
An intro to some of the basics (reading databases and drawing) is over here that uses VBA.

http://visguy.com/vgforum/index.php?topic=2298.0

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

http://visguy.com/vgforum/index.php?topic=836.0

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

al


ChapterNZ

  • Newbie
  • *
  • Posts: 2
Re: Automated N/W Diagram from mySQL database - solutions?
« Reply #3 on: April 06, 2011, 10:41:29 PM »
Hi,

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,

1)
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?

2)
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..)

aledlund

  • Hero Member
  • *****
  • Posts: 1412
Re: Automated N/W Diagram from mySQL database - solutions?
« Reply #4 on: April 07, 2011, 08:31:40 AM »
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
al

cliff50

  • Full Member
  • ***
  • Posts: 213
Re: Automated N/W Diagram from mySQL database - solutions?
« Reply #5 on: April 08, 2011, 03:49:53 AM »
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