Re: Map shape text to custom property?

From: Richard Patterson (Patterson_at_discussions.microsoft.com)
Date: 02/03/05


Date: Thu, 3 Feb 2005 08:35:07 -0800

Can this technique be used for an existing floor plan drawing? I have a
floor plan that was drawn with a CAD. I would like to link the rooms in the
drawing to information that I have in a database.

"Mark Nelson [MS]" wrote:

> If I understand correctly, you want a shape that can push its text to a
> custom property when it is created, but then you want the custom property to
> drive the text from there on out. If you want to go both ways, I believe
> you'll need to write code to keep things in sync.
>
> If you want the custom property to always refer to shape text, you already
> figured out the formula to put in the custom property cell. If you want the
> shape text to always refer to the custom property, go to Insert > Field to
> set up that relationship.
>
> --
> Mark Nelson
> Microsoft Corporation
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "HLM" <HLM@no-email.com> wrote in message
> news:eqj4vKsuEHA.3828@TK2MSFTNGP12.phx.gbl...
> > 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 shape*** 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 shape*** 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" <Maxarian@discussions.microsoft.com> wrote in message
> > news:45E98902-C697-435F-A074-DC57E954E905@microsoft.com...
> >> Please explain in detail?
> >>
> >> "HLM" wrote:
> >>
> >>> 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
> >>>
> >>>
> >>> "HLM" <HLM@no-email.com> wrote in message
> >>> news:uuPaI1duEHA.1132@TK2MSFTNGP12.phx.gbl...
> >>> >
> >>> > 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?
> >>> >
> >>>
> >>>
> >>>
> >
> >
>
>
>