Managing Linked Shapes

If you never refresh a shape or update a database after creating a link, your shapes will represent a snapshot of the database. However, if you want to keep shapes in sync with the records they’re linked to, Visio 2007 makes it easy. When you use the Link To ODBC Database command, Visio 2007 adds four commands to each shape’s shortcut menu that you can use to manage and update the link, as Figure 24-9 shows. Visio 2007 always refers to updating shape data as refreshing the shape, whereas using the shape’s values to change the database is referred to as updating the database. To refresh an individual shape or update a database record, right-click a shape, and then choose the command you want.

Figure 24-9. When you link a shape to a database record, Visio 2007 adds four commands to the shape’s shortcut menu for controlling the connection.


You can also refresh or update all the shapes on a drawing page at once as follows:

  • To refresh all the shapes, choose Tools, Add-Ons, Visio Extras, Database Refresh.

Note

To update the database with changes made to the shapes, choose Tools, Add-Ons, Visio Extras, Database Update. You must have write access to a database for Visio 2007 to update the database based on changes in a drawing file.


Adding Commands to Update All Shapes at Once

For convenience, you can add commands to the shortcut menu of a page so that you can manage the links for all the shapes on the page instead of those for individual shapes only. The Link To ODBC Database command doesn’t provide this option, but the Database Wizard does. If you’ve already used the Link To ODBC Database command to set up the links, you can use the Database Wizard to add actions and events to a drawing page. The Database Wizard provides the following options for adding actions and events:

  • Refresh Shapes On Page This action adds the Refresh Shapes command to the shortcut menu of the page. When you right-click the page and choose the command, Visio 2007 refreshes all the linked shapes on the page.

  • Update Shapes On Page This action adds the Update Shapes command to the shortcut menu of the page. When you select the command, Visio 2007 passes along to the database any changes made to the value of shape data.

  • Refresh Linked Shapes On Document Open The Open event is technical jargon for what happens when a user opens a drawing file. In this case, you can have Visio 2007 refresh all data values for linked shapes every time you open the drawing file.

  • Periodically Refresh Based On NOW Function The NOW function is programming code that creates an event that happens continuously (until you specify otherwise). In this case, the event is refreshing the linked shapes based on database values. If you select this option, Visio 2007 adds the Start Continuous Refresh command to the shortcut menu of a page. When you select this command, you create a live link between the drawing file and the database that continues to transfer data until you right-click the page again and choose Stop Continuous Refresh.

Follow these steps to add actions or events to the shortcut menu of a page that contains linked shapes:

1.
Choose Tools, Add-Ons, Visio Extras, Database Wizard.

2.
On the first wizard page, click Next.

3.
On the next screen, choose Create A Linked Drawing Or Modify An Existing One, and then click Next.

4.
On the next screen, choose Add Database Actions And Events To A Drawing Page, and then click Next.

5.
In the drop-down list, choose the drawing file (.vsd) that contains the linked shapes. If the drawing file is not open, click Browse, locate the file you want, and then click OK.

6.
Under Choose The Drawing Page To Modify, select the page for which you want to modify the shortcut menu, and then click Next.

7.
Select the actions or events you want to add to the page’s shortcut menu, and then click Next.

8.
Review your choices, and click Back to change an option if necessary. Click Finish to add the selected actions and events to the page’s shortcut menu.

Updating Shapes Automatically

You can update linked shapes automatically at regular intervals based on changes that are made to the database. Visio 2007 monitors the database at regular intervals called the refresh interval, which you specify in seconds. If the connection takes longer to update than the time you set, Visio 2007 adjusts the refresh interval.

Note

When you specify a refresh interval, it applies to all shapes that are connected to a database through the same DSN. For this reason Visio 2007 refers to this as a global setting.


Follow these steps to update shapes at regular intervals:

1.
Choose Tools, Add-Ons, Visio Extras, Database Settings.

2.
Select the Automatically Refresh Drawing Page check box.

3.
In the Refresh Drawing Interval (Secs.) box, type the number of seconds in the interval, and then click OK.

Using the Data Selector Wizard

The Data Selector is a new feature in Visio 2007 that helps you to link data to and from shapes in Visio 2007.

To link data to shapes in Visio 2007, follow these steps:

1.
On the Data menu, select Link Data To Shapes.

2.
The Data Selector Wizard then appears, as Figure 24-10 shows. On the first page of the Data Selector Wizard box, you need to select what data you wish to use. Make your selection and click Next.

Figure 24-10. With the Data Selector Wizard, you can select what kind of data you wish to link to your diagram.


3.
Click Browse to select the file you wish to use from your computer, and click Finish if you are done. Click Next if you want to choose a custom range from your data choice.

4.
If you clicked Next and you are using an Excel file, you are asked to choose the worksheet or range you want to use. Click Next. Select the columns and rows you wish to use. Click Next. Choose how you want to identify changes in data. Click Next.

5.
Click Finish.

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

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