LOL - ok, I will since I see there's someone that would read it and maybe
comment on my solution.
What I've done, in Visio Pro 2003, is copied a server shape from the rack
stencil into my own stencil so I can modify it. I then placed the server
shape on a drawing, added a couple custom properties to the shape such as
"ServerName", and ran the database wizard to connect this shape to an
access database. I had to create the ODBC DSN and the access database via
this wizard. Once I completed the wizard I opened the shapesheet for the
shape and modified the value for the custom property I wanted to "tie" to
the shape's text to be "=GUARD(SHAPETEXT(TheText))" (minus the quotes.)
and then I made sure the custom property I assigned to be the index or KEY
in the database had no value.
I then dragged the shape back to the stencil and saved it as a new master.
Now, when I drag this shape onto a drawing, I am prompted to enter a value
for the index property (the KEY field in the database). After I enter the
value the shape is dropped on the drawing. When I double-click the shape
I get the textbox edit field and the custom property page pops open. As I
type the text into the shapes textbox I can see the custom property I
"tied" it to update as I type. Since I used the "GUARD" function in the
value on the shapesheet the shape is not allowed to change this value to
anything else. It is forced to be the value of the shapes text no matter.
However, once the shape is synched to the database, the actual value is
stored in this property rather than the formula.
Why did I do this? I wanted to be able to place a new server in a rack,
have it automatically tied to my server database and have it's name
displayed as the default shape text on my drawing. This is only good for
placing a new shape on the drawing too since once the shape is synched
with the database the value for this property will be the real value,
rather than the initial formula.
I haven't worked out the details yet, but I think I'll have one shape for
adding a brand new server to my drawing which is tied in this way so I can
more easily add the server's name to a new shape and database record.
Then create a copy of the shape for adding a server to the drawing that
already has an entry in my server database. This copy would be configured
to grab the server name from the database and update the shape's text with
this value as it is dropped onto the drawing.
Really just did this as a learning experience as I embark on building a
"smart" visio drawing of all our rack elevation diagrams which is tied to
a server configuration database. Hopefully, I can have a floor plan of
our server room, click on a particular rack and have that rack's elevation
diagram open up. Then one step further, a click on a particular server
will bring up all it's pertinent information for review and or
modification.
Ok, now that I've typed this all out can someone tell me the "two-click"
method to do all this :]
Huey
Maxarian said:
Please explain in detail?
:
Aahh, just had to make sure the custom property used for the KEY in the
database was empty and then make the value for the property I wanted to
save
the shape text in:
=SHAPETEXT(theText)
Saved the master shape and now when I drag it over to my drawing I am
prompted for a KEY value and then when I double click the shape I type
the
text and the custom property updates as I type. waaay cool....
If any of this drivvle inerests anyone just post a reply, I'll give more
details.
Huey
Any quick answers? also want to link this to a database field. I have
the
link for a custom property working like a champ, but I want the
default
text property to reflect the value in a custom property.
help?