Select Page

So far, you’ve looked at ways you can access and edit an external database file.You can also link specific drawing objects to elements in a database. But before you can link your drawing to data, you must Create a link template. Link templates let you set up different sets of links to a database. For example, you can set up a link template that associates all of the phones in your AutoCAD drawing to records in your database file. Another link template can link the room numbers in your drawing to the LAST_NAME records in your database file.

This section will show you how to create a link to the database by linking your new employee to one of the vacant rooms.

Creating a Link

In the following set of exercises, you will link an AutoCAD object to the record you just added to the Employee database table. The first step is to set up a link template.

1. Close the Data View dialog box.

2. Highlight the Employee table listing in the dbConnect dialog box, then click the New Link Template tool in the dbConnect toolbar. You can also right-click the Employee listing and select New Link Template from the popup menu.

The New Link Template dialog box appears.

4. Enter Room Number for the name, the click Continue. The Link Template dialog box appears.

 The link Template dialog box lets you select a field to act as your key field. You can select more than one field for your key field.

5. Click LAST_NAME and ROOM, then click OK. Now the Room Number template appears in the dbConnect dialog box.

You’ve just created a link template. You’ll see your link template listed in the dbConnect dialog box under the drawing name. If you need to edit this link template, you can do so by right-clicking its name in the dbConnect dialog box, then selecting Redefine. Right now, you’ll continue to add a link between your drawing and the database.

You are ready to add a link to room 122.The first step is to set up your AutoCAD drawing so you can easily access the rooms you will be linking to. Then you will locate the record that is associated with room 122 in the Data View dialog box.

1. . Zoom into the set of rooms in the lower-right corner of the plan so your view.
2. Click the Employee listing in the dbConnect dialog box, then click the Edit Table tool in the dbConnect toolbar. The Data View dialog box appears. Notice that Room Number appears in the list box in the toolbar. This tells you which link template you are using. If you have more than one link template, you can select the link template you want to use from this list box.
3. Scroll down the records to locate the record you added in the previous exercise. You can also use the New Query option to isolate the record, or you can quickly get to the end of the records by clicking the end-of-table navigation arrow at the bottom of the dialog box.

4. Once you’ve found the record, click any field of the record.
5. Click the Link and Label Settings tool in the toolbar and make sure that the Create Link option is selected. This option determines what type of link AutoCAD will create.

6. Click the Link! tool in the toolbar. The Data View dialog box disappears and you see the selection cursor in the AutoCAD window .

7. Click the room number 122 and the phone in the upper-left comer of the room, then press .J to finish your selection. The Data View dialog box returns. Now . ,you sh that the record is highlighted in yellow, indicating that it is linked to an object in the current drawing. You also see a check in the button to the far left of the record. . .
8. In the Data View dialog box, link the records for room 116 and 114 to the same room numbers in the drawing. Remember to first select the record you want to link and click the Link! tool, then select the room number you want to link to. Room 116 is assigned to employee number 1022 and room number 114 is assigned to employee 1020.When you are finished, each item in the database that is linked to an object in the drawing shows a check in the far-left column.

Now you have a link established between the records for rooms 122, 116, and 114 in the database and their room numbers in your drawing. Next you’ll learn how you can use those links to locate objects in the drawing or records in your database .

Share This