Working with Shape Data

During the Visio 2007 development cycles, the product’s designers realized that the drawings could have value beyond their worth as graphical representations. Part of what makes a Visio 2007 drawing valuable is the investment of time taken to create it, but a more significant part of a drawing’s value comes in the form of important, job-critical information that can be stored right in the drawing. When you view the shapes in a drawing as meaningful conveyors of information, rather than simply graphics, you can use Visio 2007 to model systems and processes. In this sense, for example, an organization chart is not just a chart, but also a visual representation of an employee database; and shapes can serve as records in that database complete with specific fields of data such as employee name, title, date of hire, and so on. In Visio 2007, shape data are the means by which you associate valuable data with a shape.

You can see whether a shape has shape data by displaying the Shape Data window. When you select a shape on the page, the shape’s properties are displayed, as Figure 6-1 shows. Some shape data operate like fields that you type in; other shape data are set up to provide a list of options. When you click in the latter type, an arrow appears, indicating that you can open a drop-down list of choices.

Figure 6-1. Many Visio 2007 shapes include shape data, which you can define to store valuable information with a drawing.


Why would you want to go through all the effort of using a drawing as a data-entry form? After all, when you look at a drawing, you don’t necessarily know whether there’s more data behind the shapes. The answer lies in what you can do with the data after you’ve entered it. Visio 2007 can automatically generate reports based on shape data. You can display the results in a table in your drawing or save them as an external report file in HTML or XML format. Information about reports is covered later in this chapter.

In addition, you can automate the process of adding data to and extracting it from the shape data. Visio 2007 can read comma-delimited text files and a variety of databases, and shape data can be exported. By connecting diagrams and the shapes in them to live sources of data, your drawing becomes a dynamic visual representation of your database. Companies have used Visio 2007 to set up visual network inventories, manufacturing parts databases, and other mission-critical systems where a diagram provides a recognizable and easy-to-use interface for business data.

For details about linking shape data to existing data, see Chapter 24, “Connecting Diagrams and Databases.”


Using Shapes with Shape Data

Visio 2007 shapes that include built-in shape data do so for one of two reasons:

  • To provide configurable options that affect the shape’s appearance. These options allow one shape to represent several different types of symbols. For example, in an office layout, the 110-volt outlet shape can represent the symbol for a standard, dedicated, or split-wired outlet. You choose which one by using the Outlet Type shape data. Other shapes let you configure them. For example, the bar graph shape includes shape data for setting the number of bars.

  • To provide a means of associating data with a shape. For example, you can track model numbers for equipment and furniture in an office or network layout.

This chapter is concerned primarily with the second use of shape data—tracking data in diagrams. However, some shapes include both types of shape data, as Figure 6-2 shows. For example, the outlet shape includes blank shape data named Base Elevation. You can enter data for this field if you want to track how high off the floor outlets are in an office layout or floor plan, or you can leave it blank. The shape looks the same on the page either way.

Figure 6-2. This outlet shape includes shape data for configuring the symbol (Outlet Type) as well as optional properties for tracking data (Base Elevation).


Inside Out: Inside Shape Data

For Visio 2007 shape designers, shape data are often the easiest way to build intelligence into shapes. That’s why shape data perform double duty—they are used to configure the appearance of shapes and to store data with shapes. When a single shape represents multiple symbols, as with the single or duplex outlet shape, designers can provide the options to you most easily in the Shape Data window.


Most shapes include at least some shape data for configuring that shape. A few diagram types include shapes with no shape data at all. Other diagram types are specifically designed for tracking data, such as the organization chart shapes. These often include special commands or wizards to help you set up the data. In later chapters of this book that focus on specific diagram types, you’ll find information about shapes with special shape data.

Creating Data in Master Shapes

How is it that some shapes already include shape data? The explanation lies in how shapes inherit information from masters when you drag them from stencils onto the drawing page. You can create and save shape data with master shapes, which is what the Visio 2007 shape designers have done, as Figure 6-3 shows. By dragging a shape on the page, you create a copy of the master shape that inherits all of the master’s shape data (as well as other attributes). To use the shape data, all you have to do is enter data.

Figure 6-3. When shape data are defined for a master shape, every time you drag that master onto the drawing page, your shape will include the same data.


Because shapes inherit data from the master shapes, it makes sense that when you want to edit or add shape data, you work with the master shapes. You have to decide, though, which stencil to edit:

  • Edit a Visio 2007 stencil file when you want to add, edit, or remove shape data for all drawings that use shapes from that stencil.

  • Edit a document’s stencil as Figure 6-4 shows when you want to add, edit, or remove shape data for the shapes you’ve used in one drawing.

    Figure 6-4. To edit shape data in a way that affects only the shapes in a drawing, you can edit the master shapes on the document stencil.

Note

You cannot edit the master stencils that ship with the software. You may add shapes to a custom stencil, such as My Shapes (described later in this chapter), or edit the shapes on a document stencil, but you may not edit the master stencil.


You can right-click any shape in a master or document stencil and choose the Add To My Shapes options. This allows you to add it to a folder named My Shapes (or anything else you like).

This is a big decision because it affects where your changes are saved—with a reusable stencil file or just in your drawing. If you don’t want to affect the shapes for all future uses, you clearly don’t need to add the edited shapes to the My Shapes or any other custom stencil that you have created. In that case, you edit the document stencil in your drawing file. The document stencil stores a copy of each master shape you’ve used in a drawing, as Figure 6-5 shows. By editing the master shapes on the document stencil, all the shapes in your drawing that are based on those masters will be updated, including those that have already been placed in the diagram. In this way, you can add, edit, and delete shape data once instead of changing each individual shape.

Figure 6-5. To prevent the Shape Data window from obscuring your diagram while you work, you can dock the window below the drawing page.


For details about document stencils and the Visio 2007 file format, see the section titled “Mastering Visio Documents” in Chapter 21, “Customizing Shapes and Solutions.”


Customizing the Shape Data Window

When you first open the Shape Data window, Visio 2007 docks it against a ruler. However, you can place the window just about anywhere by dragging its title bar. The window can float on the drawing page and outside the Visio 2007 window or it can dock against an edge of the page, below the drawing page in its own pane, as Figure 6-5 shows, or in the stencil area. Table 6-1 lists the techniques for locating the Shape Data window.

Table 6-1. Arranging the Shape Data Window
TaskTechnique
Display the Shape Data windowChoose View, Shape Data Window.
Set the Shape Data window to automatically move out of your wayClick the pushpin icon or right-click anywhere in the Shape Data window, and then select AutoHide.
Keep the window open at all timesClick the pushpin icon or right-click in the Shape Data window, and then deselect AutoHide.
Make the Shape Data window float on the drawing pageDrag the window by its title bar away from its docked position, or right-click anywhere inside the Shape Data window, and then choose Float Window.
Dock the Shape Data windowDrag the title bar of the Shape Data window into the stencil area, against the side of the drawing page, below the drawing page, or right-click anywhere inside the Shape Data window and then choose Anchor Window.

Note

You can dock windows within windows. For example, you can dock the Shape Data window with the Pan & Zoom window. Each window then displays a tab at the bottom of the window that you can select to display the window.


Inside Out: The Shape Data window also lists page properties

If no shapes are selected, the Shape Data window lists any data that are defined for the page. In general, page properties are used only by a Visio 2007 solution to configure the page for a particular diagram type. For example, the Gantt template uses page properties to set up default task information.


Displaying Data for One Shape

You can display the shape data temporarily for one shape. Right-click the shape, as Figure 6-6 shows, and then select Properties; or select Data, Shape Data. This won’t work for all shapes. Only shapes that are designed for tracking data or for setting configuration options include the Properties or Data, Shape Data command on their shortcut menus. When you display shape properties this way, Visio 2007 opens the Shape Data dialog box, as Figure 6-7 shows. You can then enter data and click OK to close the dialog box.

Figure 6-6. When you right-click some shapes with shape data, the Properties command appears on their shortcut menus. Not all shapes include this command.


Figure 6-7. You can work in a shape’s Shape Data dialog box instead of the Shape Data window, but both include the same set of properties. This dialog box is for a shape from the Basic Network Shapes stencil.


Inside Out: Creating Configurable Shape Data

Can you create shape data fields that provide configurable options, such as the built-in Visio 2007 properties that display a drop-down list of options? The answer is yes, if you’re willing to write a program to do so.

It’s beyond the scope of this book to describe exactly how to write such a program, but it starts with the Shape Data section of a ShapeSheet, where you can write formulas that link a shape’s geometry or style attributes to its shape data. In that way, you can design shapes that respond to user input in the Shape Data window. In addition, you can use an external program to create shape data and get and set shape property values. For details, refer to the developer reference (Help, Developer Reference) or search for Visio 2007 information on http://msdn.microsoft.com.


Accessing Shape Data Through the ShapeSheet

If you want to study the way Visio 2007 shapes use shape data, look in the ShapeSheet window. (You must be in Developer Mode. Choose Tools, Options, select the Advanced tab, then turn on the Run In Developer Mode check box. To display the Shapesheet window, right-click a shape and choose Show ShapeSheet.) As Figure 6-8 shows, the Shape Data section includes all the information you see in the Shape Data window, plus a few additional options that shape programmers can use. For example, the Invisible cell lets you define shape data that do not appear in the Shape Data window—something you might want to do if you used an external program to control shape properties.

Figure 6-8. Cells in the Shape Data section of the ShapeSheet show the labels and values that you see in the Shape Data window.


You can define shape data and its values in the ShapeSheet window, but unless you’re using a program to automate the process, you’re better off working with the tools in the drawing page. However, the way Visio 2007 references ShapeSheet cells affects the way certain shape data options are displayed in other parts of the user interface. For example, let’s say you define shape data called Name. Visio 2007 adds a row to the Shape Data section of the ShapeSheet called Prop.Name. When you’re creating reports or exporting data, sometimes you’ll see your property listed as Name and sometimes as Prop.Name. If you’re writing ShapeSheet formulas that refer to the shape data cells, you must use proper ShapeSheet syntax. For example, to refer to the value of the Name shape data in a formula, you type Prop.Name.Value where Value tells Visio 2007 to look in the Value column of the Name row of the Properties section.

For details about ShapeSheet syntax, see the section titled “Writing ShapeSheet Formulas” in Chapter 25, “Making Shapes Smart.”


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset