Chapter 6: Storing Data in Diagrams


Besides the great visuals you get from a drawing or diagram, you can use Microsoft Office Visio 2003 to store a great deal of information. Most diagram types are designed to include data in the form of customizable shape properties called custom properties. Custom properties provide a data-entry interface for a shape. For example, organization chart shapes can store data about employees, such as name and job title. Network shapes can store data about devices and equipment, such as manufacturer and model number. You don’t have to take advantage of these properties; your drawings and diagrams can remain just as they are. But if you want to provide a deeper layer of information about your drawing’s contents—infor- mation that can be extracted in reports and other forms—you can store data as custom properties.

This chapter describes how to use and revise the built-in custom properties that come with many Visio shapes and how to create new properties. In addition, this chapter describes the reporting tools that can be used for any drawing or diagram that contains custom property data.

Working with Shapes, Data, and Custom Properties

During Visio’s 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 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 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, a custom property is the means by which you associate valuable data with a shape.

You can see whether a shape has custom properties by displaying the Custom Properties window. When you select a shape on the page, the shape’s properties are displayed, as Figure 6-1 shows. Some custom properties operate like fields that you type in; others 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.

click to expand
Figure 6-1: Many Visio shapes include custom properties, 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? Typing in custom property fields is bound to be time consuming. And 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 once you’ve entered it. Visio can automatically generate reports based on custom property 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 custom properties. Visio can read comma-delimited text files and a variety of databases, and custom property information can be exported. By connecting diagrams and the shapes in them to live sources of data, your drawing becomes a visual representation of your database. Companies have used Visio 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.

Cross-Reference

For details about linking custom properties to existing data, see Chapter 24, “Connecting Diagrams and Databases,” page 711.

Using Shapes with Custom Properties

Visio shapes that include built-in custom properties 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 custom property. Other shapes let you configure them, such as the bar graph shape, which includes a custom property 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 custom properties—tracking data in diagrams. However, some shapes include both types of custom properties, as Figure 6-2 shows. For example, the outlet shape includes blank custom properties Base Elevation. You can enter data for this field if you want to track this type of information 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 custom properties for configuring the symbol (Outlet Type) as well as optional properties for tracking data (Base Elevation).

start sidebar
Inside Out
Inside custom properties

For Visio shape designers, custom properties are often the easiest way to build intelligence into shapes. That’s why custom properties perform double duty—they’re used to configure and store data with shapes. When the designers want a single shape to represent multiple symbols, as with the single or duplex outlet shape, they can provide the options to you most easily in the Custom Properties window.

end sidebar

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

Creating Properties in Master Shapes

How is it that some shapes already include custom properties? 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 custom properties with master shapes, which is what the Visio 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 the master’s custom properties (as well as other attributes). To use the custom properties, all you have to do is enter data.

click to expand
Figure 6-3: When custom properties are defined for a master shape, every time you drag that master onto the drawing page, your shape will include the same set of properties.

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

  • Edit a Visio stencil file as Figure 6-3 shows when you want to add, edit, or remove custom properties 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 custom properties for the shapes you’ve used in one drawing.

    click to expand
    Figure 6-4: To edit custom properties in a way that affects only the shapes in a drawing, you can edit the master shapes on the document stencil.

    Note

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

New Feature In Visio 2003 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 stencil 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. By editing the master shapes on the document stencil, all the shapes in your drawing that are based on those masters will be updated. In this way, you can add, edit, and delete custom properties and affect all the shapes in your drawing.

Cross Reference

For details about document stencils and the Visio file format, see “Mastering Visio Documents,” page 609.

Customizing the Custom Properties Window

When you first open the Custom Properties window, Visio 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 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 Custom Properties window.

Tip

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

click to expand
Figure 6-5: To prevent the Custom Properties window from obscuring your diagram while you work, you can dock the window below the drawing page.

Table 6-1: Arranging the Custom Properties Window

Task

Technique

Display the Custom Properties window

Choose View, Custom Properties Window.

Set the Custom Properties window to automatically move out of your way

Click the pushpin icon or right-click anywhere in the Custom Properties window, and then select AutoHide.

Keep the window open at all times

Click the pushpin icon or right-click in the Custom Properties window, and then deselect AutoHide.

Make the Custom Properties window float on the drawing page

Drag the window by its title bar away from its docked position, or right-click anywhere inside the Custom Properties window, and then choose Float Window.

Dock the Custom Properties window

Drag the title bar of the Custom Properties window into the stencil area, against the side of the drawing page, below the drawing page, or right-click anywhere inside the Custom Properties window and then choose Anchor Window.

start sidebar
Inside Out
The Custom Properties window and page properties

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

end sidebar

Tip

Play a sound when the window opens You can have sounds play when the Custom Properties window opens and closes. To add sounds, open Windows Control Panel, choose Sounds, and then define a sound for the Restore Up and Restore Down event. Note that these changes will affect all Windows programs, not just Visio 2003.

Displaying Properties for One Shape

You can display the custom properties temporarily for one shape by right-clicking the shape, as Figure 6-6 shows, and then selecting Properties. This won’t work for all shapes. Only shapes that are designed for tracking data or for setting configuration options include the Properties command on their shortcut menus. When you display shape properties this way, Visio opens the Custom Properties 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 custom properties, the Properties command appears on their shortcut menus. Not all shapes include this command.

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

start sidebar
Creating Configurable Custom Properties

Can you create custom property fields that provide configurable options, such as the built- in Visio 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 Custom Properties section of a ShapeSheet, where you can write formulas that link a shape’s geometry or style attributes to its custom properties. In that way, you can design shapes that respond to user input in the Custom Properties window. In addition, you can use an external program to create custom properties and get and set custom property values. For details, refer to the developer reference (Help, Developer Reference) or search for Visio information on http://msdn.microsoft.com.

end sidebar

Accessing Custom Properties Through the ShapeSheet

If you want to study the way Visio shapes use custom properties, look in the ShapeSheet window. As Figure 6-8 shows, the Custom Properties section includes all the information you see in the Custom Properties window, plus a few additional options that shape programmers can take advantage of. For example, the Invisible cell lets you define a custom property that does not appear in the Custom Properties window—something you might want to do if you used an external program to control shape properties.

click to expand
Figure 6-8: Cells in the Custom Properties section of the ShapeSheet show the labels and values that you see in the Custom Properties window.

You can define custom properties and their 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 references ShapeSheet cells affects the way certain custom property options are displayed in other parts of the user interface. For example, let’s say you define a custom property called Name. Visio adds a row to the Custom Properties 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 custom property cells, you must use proper ShapeSheet syntax. For example, to refer to the value of the Name custom property in a formula, you type Prop.Name.Value where.Value tells Visio to look in the Value column of the Name row of the Properties section.

Cross Reference

For details about ShapeSheet syntax, see “Writing ShapeSheet Formulas,” page 740.




Microsoft Office Visio 2003 Inside Out
Microsoft Office Visio 2003 Inside Out (Inside Out (Microsoft))
ISBN: 0735615160
EAN: 2147483647
Year: 2003
Pages: 209

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net