When you want to add data fields to a Visio shape,
you need to open the Define Shape Data dialog box. To do so, right-click
a shape, point to Data, and then click Define Shape Data.
Tip:
You
can also open the Define Shape Data dialog box by right-clicking
anywhere in the Shape Data window and then clicking Define Shape Data.
The Define Shape Data
dialog box looks like one of the following two samples. The one on the
left appears for most Visio users. The one on the right appears if you
are running Visio in developer mode, and offers several additional
options.
Note:
For information about developer mode, see the Appendix.
In both variations of the dialog box, notice that each data field has multiple attributes:
Label Field name
Type One of the eight types
Format Determines how data entered by the user will be presented; different field types have different format options
Value The data value entered when a shape was defined or entered by the user
Prompt Tooltip text that appears when the user points to the shape’s name in the Shape Data window
In developer mode, you will see
the additional attributes described in the following list. Although
some of them are primarily for use by programmers, one or two may be of
value even if you are not a programmer:
Name
An internal name used by Visio programmers; can be the same as Label
except that Name cannot contain spaces or most special characters (an
underscore character is OK).
Sort key
Visio uses the alphanumeric value in this field to determine the
sequence in which fields will be presented in the Shape Data window.
Warning:
Important
Visio treats the contents
of the Sort key field as text even if you enter a number, which means
that it arranges fields based on alphabetic sequence rather than numeric
sequence. For example, if field A has a sort key of “1”, field B has a
sort key of “2”, and field C has a sort key value of “10”, Visio will
place them in the Shape Data window in the sequence A, C, B, because the
first character “1” in field C is less than the “2” in field B.
Add on drop If selected, Visio opens the Shape Data dialog box whenever the user drops a shape containing this field onto a page.
Hidden
If selected, Visio hides this field; that is, the field does not appear
in either the Shape Data window or Shape Data dialog box. Fields like
this are often used by programmers to hold intermediate calculations or
results that the user does not need to see.
Tip:
The shape data exercises that follow all use the regular Define Shape Data dialog box and not the developer version.
Although it is not
advertised in any obvious way, you can create, edit, or delete shape
data fields for more than one shape at a time. If you select multiple
shapes before opening the Define Shape Data window, the changes you make
will be applied to all selected shapes. This feature can be very powerful or very destructive, so it pays to be cautious.