TU0119 Linking from a Company Database to Components i.

Linking from a Company
Database to Components in
Your Design
Summary
Tutorial
TU0119 (v1.1) November 18, 2004
This tutorial describes how to set up links from a company
component database to components placed on a schematic.
Database linking allows data to be transferred from the
database to the component parameters which can then be
included in the Bill of Materials (BOM).
With DXP, you can flow information from a company component management system into the DXP
design environment by linking an external company database to components placed on the schematics
in a PCB project.
Links are established between schematic component parameters and an external database through a
Database Link file added to your PCB (.PrjPCB) or Library (.LibPkg) project. This file allows for links
to be specified via ODBC connections, as well as having predefined support for MS-Access and MSSQL server connections.
The following diagram shows an example of links formed using a Database Link file between an MS
Access database and a schematic component in DXP. We will investigate how these links were set up
during this tutorial with reference to the database linking example located in the \Program
Files\Altium2004\Examples\Reference Designs\4 Port Serial Interface folder.
This example project links its schematic components to an MS Access database named Example
database.mdb, located in the \Program Files\Altium2004\Examples\Cis folder.
TU0119 (v1.1) November 18, 2004
1
Linking from a Company Database to Components in Your Design
*.mdl file
MS Access database
DXP Schematic Editor
Database Link file (*.DbLink)
Parameters list in Component Properties dialog
Schematic component with parameters visible
Company component management system linked to schematic components in the 4 Port Serial Interface example.
Using database files
While database connections in DXP are set up for MS Access databases (*.mdb files) by default, any
ODBC-compliant database can be accessed. This makes other configurations possible, such as using
an Excel file (*.xls) as the external database. See Linking to an Excel document later in this tutorial
for more information about using Excel files as the database.
1. Create a database file (*.mdb) using MS Access that contains the company component
information. Have a look at \Program Files\Altium2004\Examples\Cis\Example
database.mdb for an example of how to set up an Access database that uses multiple tables.
2
TU0119 (v1.1) November 18, 2004
Linking from a Company Database to Components in Your Design
2. Make sure the data types are correctly set in the database file, e.g. Text is used for text string
parameters. Save the database file (*.mdl) and close. Exit MS Access.
3. Open DXP and open the PCB project, 4 Port Serial Interface.PrjPCB, located in the
\Program Files\Altium2004\Examples\4 Port Serial Interface folder. Open the
project’s schematic documents.
Creating a Database Link file
Now that the database file exists, you need to create a Database Link file (*.DbLink) in DXP. A
Database Link (DbLink) file is used to define the linking between placed components on schematic
documents and the database. When this file is set up, the components on the schematics can be
updated with information from the database by updating the linked parameters.
While a Database Link file already exists for the 4 Port Serial Interface project, we will create one from
scratch to demonstrate its use. You would need to set up a new Database Link file if you wished to
connect the project to another external database.
1. To add a Database Link file to your PCB project, select the project name 4 Port Serial
Interface.PrjPCB in the Projects panel and choose File » New » Database Link File.
TU0119 (v1.1) November 18, 2004
3
Linking from a Company Database to Components in Your Design
2. A new file, Database Links1.DbLink, displays in the design window and is added to the
Settings\Database Link Files sub-folder in the Projects panel.
Specifying the database connection
Once you have added a Database Link file, you can specify the connection to the database. Then you
can indicate which database fields should match up with which design parameters and how design
updates should occur.
1. To connect your project to the
database, select Tools »
Database Connection. The
Connection tab of Database
Connection dialog displays.
Connections can be made via a
Data Link file (*.udl ) or by the
use of a connection string that
links to an external database file
(e.g. *.mdb). Note that linking to
the example database is done
using an absolute path, which
defaults to C drive. Change this in the Database Connection dialog if necessary.
2. For this tutorial, we will use a connection string to the Access database file, so select Use
Connection String and click on Build. The Data Link Properties dialog displays. The default OLE
DB provider, Microsoft Jet 4.0 OLE, is set in the Provider tab.
Pressing F1 or clicking on the
Help button in the Data Link
Properties dialog displays
Microsoft (not DXP) help.
For more information on
Microsoft's ADO Provider
Properties and Settings, try
this link:
http://msdn.microsoft.
com/library/default.as
p?url=/library/enus/dnacc2k/html/adopro
perties.asp.
3. From the Connection tab, select the database name you want to connect to by clicking on the
and selecting the filename, e.g. C:\Program Files\Altium2004\
browse button
Examples\Cis\Example database.mdb in the Select Access Database dialog. Click Open.
4
TU0119 (v1.1) November 18, 2004
Linking from a Company Database to Components in Your Design
4. To check the connection to the database has been successful, click
on Test Connection. If the connection is found, a confirmation
dialog displays. Click OK until all dialogs are closed.
5. Once connected, the Database Link file (*.DbLink) displays data in
the Table Browser and Database Links tabs.
6. Make sure the Tables you wish to use are enabled.
The Table Browser tab in the Database Link file allows you to view
your database tables for reference. The actual values can not be
edited here as any changes must take place within the external
database itself.
The Database Links tab is used to correlate database fields for each table with your design
parameters. Refer to Setting database link options later in this tutorial for more information about
setting the database links.
Setting key fields and key parameters
To match up information from the database file with the parameters in the schematics, a Database Key
Field must match up with a Part Key Parameter via the Database Link file. Typically, the key field is
something that uniquely identifies a component in the database, such as a company part number.
Information is read from the selected Part Key Parameter name that exists in the placed schematic
TU0119 (v1.1) November 18, 2004
5
Linking from a Company Database to Components in Your Design
components and then is searched for in the chosen database key field in the database file. When there
is a match, other cells from that record in the database can then be taken back to the mapped
parameters in the schematic component.
Key fields are set in the Database Link file for each connected
table. You must first select one Database Key Field and one
existing design parameter (Part Key Parameter) as the key fields
which are used for matching from the schematic part to a table
row in the database. If no suitable Part Key Parameter exists, one must be created. See Creating a
Part Key Parameter using the Parameter Manager for more information. To match up the Single Key
lookup key field and key parameter:
1. Select a Database key field from the drop-down list of column headings found in the database. In
our 4 Port Serial Interface project example, the Part Number field in the database will be matched
with the Part Number parameter in the schematic components.
2. Select a Part key parameter from the drop-down list of parameter names found in the schematic
document in your PCB project. Save the Database Link file.
SQL matching of multiple fields and parameters
While the single-key lookup described above requires a precise correlation between one database
column and one design parameter, using the Where clause allows you to create a key match between
multiple database fields and parameters. This advanced feature is recommended only to users
proficient in SQL.
The following Where clause example shows the basic pattern for creating a key match between
multiple fields and parameters. In this case, a single row in the relevant table of the database would be
linked to using three different part parameters.
Capacitance = '{Capacitance}' AND Tolerance = {Tolerance} AND
Manufacturer = '{Manufacturer}'
The second example below suggests some of the powerful advantages of making your key match
through an SQL statement.
[Package] = '{Footprint}' AND '[Value]' like '{Comment}%' AND [Tolerance]
<= {Tol} + 0.01 and [Tolerance] >= {Tol} - 0.01
Notice that the design parameters are always referenced within curly braces. Single quotes around
these braces will treat the parameter value as a string; the absence of quotes around a parameter will
cause its value to be treated as a number. Square brackets for database columns are only usable in
MS databases (Access, etc.), and should otherwise be left off. Quotes are only required around
database column names if these contain spaces or reserved words.
Creating a Part Key Parameter using the Parameter Manager
If no suitable parameter exists in your placed schematic components to be used as a Part Key
Parameter in the Database Link file, you can use the Parameter Manager to add a new parameter to all
relevant components. Note that you do not need to do this section of the tutorial as the Part Number
parameter has already been added to each component in the 4 Port Serial Interface example
schematics.
6
TU0119 (v1.1) November 18, 2004
Linking from a Company Database to Components in Your Design
To add a new parameter using the Parameter Manager:
1. In the Schematic Editor with the required schematic documents open, select Tools » Parameter
Manager. The Parameter Editor Options dialog appears.
2. To add the new parameter to all parts in the schematic, select Parts in the Include Parameters
Owned By section of the Parameter Editor Options dialog and select All Objects as the criteria.
Click OK and the Parameter Table Editor dialog displays.
3. Click on Add Column. The Add Parameter dialog displays. Type in a new parameter name and
click on Add to all objects. No value is required. Click OK.
4. Click on Accept Changes (Create ECO) to display the Engineering Change Order dialog.
TU0119 (v1.1) November 18, 2004
7
Linking from a Company Database to Components in Your Design
5. Click on Validate Changes. If the validation is successful (the Status column shows a green tick),
click on Execute Changes.
6. When the changes have been executed, click Close. The new parameters are added to the
components in the schematic. These can be checked by double-clicking on the components in the
schematic document to display the Component Properties dialog. The new parameter is add to the
Parameters list.
Setting database link options
Once the connection from the schematic to the database is defined and key fields and parameters set,
any values that are in the database can be transferred to the schematic by mapping them in the
Database Links tab of the Database Link file.
Setting default database link options
You can set default actions for adding, updating and removing parameters in your schematic
documents. You may want to always add a parameter to components but only if there is a value in the
database, for example. You can also choose to update or remove parameters or not. These actions will
take place when you run the Update from Database command. These defaults can be overridden for
particular instances in the Database Link file.
1. To set the default options, select Tools » Options. Alternatively, right-click on a cell and select
Options. The Database Link Options dialog displays.
2. Define the default set of actions to be applied when updating the parameters of placed schematic
components with information from corresponding fields in the external database. Select the default
options from the drop-down lists available.
8
TU0119 (v1.1) November 18, 2004
Linking from a Company Database to Components in Your Design
3. The settings defined in this dialog will only be applied if the Default entry is chosen in the Update
Values, Add To Design or Remove From Design columns for parameter entries in the associated
Database Link File. You have full control over updating parameters from the database as you can
use these default settings or individually set the update, add and remove actions. Click OK to return
to the Database Link file.
Creating database links
Now you have defined the default actions that will take place when you update the schematic
components, you need to create the database links in the Database Link file.
To create the database links in the Database Links tab of your Database Link file:
1. Highlight a row and press Ctrl+D.
2. A proposed Design Parameter for your design is created and named the same as the database
field name. All the default update options (Default) are enabled as defined in the Database Link
Options dialog.
3. If you want the database field to link to a different parameter name (existing or new), click on the
Design Parameter name to select it and then click again to either choose the new parameter name
from the drop-down list, or type it in yourself.
4. Repeat step 1 for all the database links you want to create. A green tick indicates a link has been
successfully made between the database field name and the design parameter.
Changing the update options for individual parameters
You may want individual fields to ignore the default settings when updating parameter values from the
database. To change from Default in the Update Values, Add To Design or Remove From Design
columns:
1. Click to select the field for editing. Click again and an arrow appears to indicate a drop-down list is
available.
TU0119 (v1.1) November 18, 2004
9
Linking from a Company Database to Components in Your Design
2. Select the required action from the drop-down list for the database fields whose default behavior
you wish to override. The action is updated in the Database Link file. Save the Database Link file.
You can still reject any of the proposed changes when you update your schematic documents from the
database using an Engineering Change Order (ECO).
Updating schematics from the database
When all settings are defined as required, use the Update from Database command to create an
Engineering Change Order which will implement the changes when executed.
1. Return to your schematic document and select Tools » Update from Database to synchronize
parameter values with your database. The Update from Database dialog displays. Use the dialog to
select which schematic documents and component types you wish to include in the update.
2. Define the scope of the update by selecting (ticking) the sheets and component types to be updated
and click OK. The external database is queried for matching parts and then a list of schematic parts
that will be updated is displayed in the Select Parameter Changes dialog.
3. This dialog allows you to decide at the parameter level whether to proceed with an update or reject
it. Click on Update All or select only those objects you wish to update. This gives you final control
over which parameters are updated from the database. Then click on Accept Changes (Create
ECO). The Engineering Change Order dialog displays.
10
TU0119 (v1.1) November 18, 2004
Linking from a Company Database to Components in Your Design
4. Click on Validate Changes and check the Status is OK (ticked). Click on Execute Changes to
update the parameters. When the changes have been executed (Done), click Close.
5. The parameters in the placed schematic components are updated. These can be checked by using
the Parameter Manager, by using a query of IsParameter in the List panel, or by double-clicking
on the components in the schematic document to display the Component Properties dialog.
Linking to an Excel document
While database connections are set up for Access databases (*.mdb files) by default, you can also
use an Excel file as the source database.
To link an existing Excel document to your schematic document:
1. Add a Database Link file (*.DbLink) to your PCB project by selecting File » New » Database
Link File.
2. Select Tools » Database Connection. Select Use Connection String and click on Build. The
Data Link Properties dialog displays.
3. Click on the Provider tab and make sure the Microsoft Jet 4.0 setting is selected. This is the
default setting for new Database Link files as it is also used for Access database files.
4. Click on the All tab. Double-click on the Extended Properties field and enter Excel 8.0 in the
Property Value field of the Edit Property Value dialog. Click OK.
TU0119 (v1.1) November 18, 2004
11
Linking from a Company Database to Components in Your Design
to find your Excel (.xls) file from
5. Click on the Connection tab and use on the browse button
the Select Access Database dialog. Change the file type to All Files (*.*) to list any Excel files.
Select the Excel file required and click Open.
6. Click Test Connection and the confirmation message appears if successful.
7. The Database Link file will show each of your Excel sheets as an individual table, so make sure the
required tables are enabled. The table name will have a dollar sign ($) appended. This is an Excel
convention and will not affect the linked values.
8. Set the key fields, update action options and create the data links required (using Ctrl+D) as you
would when using an Access database as the external source.
9. When the Database Link file is set up and saved, select Design » Update from Database and
execute an ECO. The selected component parameters in the selected schematic documents are
updated from the database.
Using the new parameters when generating a BOM
Once the new parameters and updated values have been successfully integrated into your design, you
can use the Report Manager to create a Bill of Materials that incorporates the new component
information. The following steps summarize this procedure. Refer to the Customizing Component
Reports tutorial for more information about arranging data for inclusion in a BOM and using Excel
templates.
1. In an Excel BOM template file, add the new column name, e.g. Column=Part Number. Save the
new template (e.g. BOM Default Template1.xlt) in the \Program
Files\Altium2004\Templates folder and close the template file.
2. In DXP, select Reports » Bill of Materials to display the Report Manager (titled the Bill of Materials
(By Part Type) for Project [Project name.PRJPCB] dialog when generating a BOM).
12
TU0119 (v1.1) November 18, 2004
Linking from a Company Database to Components in Your Design
3. Select the columns you wish to show in the report by clicking on the Show box next to the column
name, e.g. Part Number, in the Other Columns section of the dialog.
4. Browse using the
button to where your new template name, e.g. BOM Default
Template1.xlt, is located and click Open to display the name in the Template field.
5. Click on the Excel button to preview the resulting Excel spreadsheet. You will notice the data from
the new column, Part Number, added to the BOM.
6. Select Open Exported and click OK to open the new Excel spreadsheet of your DXP BOM in MS
Excel.
7. You can now further modify your BOM in Excel if desired.
TU0119 (v1.1) November 18, 2004
13
Linking from a Company Database to Components in Your Design
Revision History
Date
Version No.
Revision
9-Dec-2003
1.0
New product release
18-Nov-2004
1.1
Updated for SP2
Software, hardware, documentation and related materials:
Copyright © 2004 Altium Limited.
All rights reserved. You are permitted to print this document provided that (1) the use of such is for personal use
only and will not be copied or posted on any network computer or broadcast in any media and (2) no modifications
of the document is made. Unauthorized duplication, in whole or part, of this document by any means, mechanical or
electronic, including translation into another language, except for brief excerpts in published reviews, is prohibited
without the express written permission of Altium Limited. Unauthorized duplication of this work may also be
prohibited by local statute. Violators may be subject to both criminal and civil penalties, including fines and/or
imprisonment. Altium, CAMtastic, Design Explorer, DXP, LiveDesign, NanoBoard, Nexar, nVisage, P-CAD, Protel,
Situs, TASKING and Topological Autorouting and their respective logos are trademarks or registered trademarks of
Altium Limited or its subsidiaries. All other registered or unregistered trademarks referenced herein are the property
of their respective owners and no trademark rights to the same are claimed.
14
TU0119 (v1.1) November 18, 2004