Step 3: Reel In Your Data
These steps are a hand-pull through the wizard; it's a boring read, but it will show you what Microsoft should have put in their docs and had to do for me over the phone. There's even a step beyond the wizard for linking shapes to records in the database, before you can even think about getting the shapes to change colors for different conditions.
In Visio, select the first cross.
From the Tools menu, choose Add-Ons, Visio Extras, Database Wizard. Choose Next.
Make sure that the radio button is selected for the option Link Shapes to Database Records; then choose Next.
Choose Shapes in a Drawing and click Next.
Make sure that the name of your drawing is in the top of this next dialog box, and that the page number at the bottom of your drawing is in the middle of the dialog box, as shown in Figure 5. If you're on the correct page, you should be able to scroll to the correct shape name in the list ("cross," in this example). This is a dialog box that can trip you up. It says Select Shapes, and you'll be tempted to highlight just the word Cross. You need to select all 10 crosses in the drop-down list. This can be fixed in post, but you don't want to do it. Instead, select all of those crosses. (It's okay if their numbers aren't 110, as long as there are 10.) Click Next.
Choose the type of data source you're using (Microsoft Access database, for this example) and click Next.
Select your database file. Choosing a database object to connect to is probably best left at the default settings; same with the object types. Tables and Views should be checked already; Product Reorders should appear in the Database Objects scroll list. Make sure it's highlighted. Leave the Define Table button alone and click Next.
In the dialog box to choose the number of fields that comprise the primary key for the selected table, choose 1 (one). Click Next. For the primary key field, choose Product ID and click Next.
For the default key value, choose Noneit's a button below the place where normal selections are made, but it's important to choose it (see Figure 6). Click Next.
In the following dialog box, you choose events and actions to add to the shape. Skip the Shape (on Drop) events. For Right Mouse Actions, choose Select Database Record and Refresh Shape Cells. For security reasons, skip Update Database Record and Delete Shape and Database Record. Click Next.
Now it's time to choose the shape cell to be used for storing the primary key field value. The correct default will be a variant on the primary key itself, so if your primary key is ProductID, the shape cell will be Prop.ProductID. Click Next. The Link ShapeSheet Cells to Database Fields dialog box has an Automatic button that should put together names such as the above, though with a more formulaic flair. Click Next; then click Finish (see Figure 7).
Now you're outside the wizard. (Aren't you glad Inform IT is here?) Right-click the first shape in the drawing and choose Select Database Record from the pop-up menu. A list of all the record's primary key values appears. Choose the first record's primary key value (or the one that matches the first text drawing or photo (Autoclave is 1), and click OK.
Right-click the next shape and choose its primary key value (2, and so on), and click OK through the inventory. Because the primary key values are just numbers (and in this case, those numbers happen to be the Product IDs), it's a good thing we included the Product ID numbers in the static art, right?
Figure 5 Match filename at top of dialog to filename at top of page. Scroll to match page number in the middle of dialog to page number at bottom of page. Select all 10 crosses contained in the page, regardless of numbers beside them in the dialog box.
Figure 6 Don't skip clicking the None button in this dialog box.
Figure 7 Visio presents the three database field names you need in the second column. When you move them to the right, they get the names they need as they're linked to ShapeSheet cells.
Your database is hooked up to Visio! Take a celebratory break and refresh yourself with a cool Frapp Lite, or work just a few more minutes to see your SmartShapes refresh themselves with a cool black "light" when they dip into a low inventory condition.