Datalinks - Further Information
- Last UpdatedJul 15, 2025
- 4 minute read
Electrical Designer enables any attribute within any AutoCAD drawing to be updated from the AVEVA Electrical Project Database. A Datalink is attached to each block's attributes in a Template file or Seed file as Extended Entity Data (Xdata). Extended Entity data is invisible in AutoCAD, so the Datalinks will not effect the AutoCAD file visually.
Note:
Datalink definitions are invisible within the drawing file and can only be accessed
by an applications program such as Electrical Designer (or AutoLisp/Visual Basic etc.).
An AVEVA Electrical Datalink represents a data value that is replaced by the actual project data when updated by Electrical Designer. When a drawing is updated by Electrical Designer all AutoCAD attributes that contain a Datalink are automatically updated with the current data from the AVEVA Electrical project database. This data could include title block and revision information as well as engineering, wiring or other project data.
Types of Datalinks
Designer uses two types of Datalinks:
-
Keywords. These are always enclosed in curly brackets {}
Examples:
|
{DwgNo} |
returns the value of the Drawing Number field for the current drawing. |
|
{Title1} |
returns the value of the Title1 field of the Drawings List for the current drawing. |
-
SQL Statements. These are always enclosed in curved brackets ( ) and are written in the form of a standard SQL (Structured Query Language) query definition for database access:
(SELECT Field1 FROM TableName WHERE Field2 = Value)
Keyword Datalinks are predefined within the Electrical Designer and cannot be user defined.
SQL Statements are user definable and are included to enable advanced users to access data that has not been defined as a Keyword Datalink.
Note:
To view available Keyword Datalinks for any drawing in the Drawings List access the
Datalinks Window.
Multiple Datalinks
Electrical Designer supports multiple Datalinks for each Block Attribute. They can be used to update multiple values within a single attribute.
For example:
Attribute with Datalinks: {DWGNo} {Rev1} would fetch the current drawings 'Drawing No' and 'Rev1' fields and append them together with a space in between (such as D1234 A - if 'Drawing No was: 'D1234' and Revision 1 was 'A').
Character or numerical values may also be concatenated within the Datalink definition.
For example:
Attribute with Datalinks: Dwg No.{DWGNo}-{Rev1} would fetch the current drawings 'Drawing No' field and append it after the characters 'Dwg No. ' followed by a '-' (dash) followed by the current drawings value of the 'Rev1' field.
Nested Datalinks
Electrical Designer supports Nested Datalinks for each Block Attribute. They can be used to update multiple values within a single attribute or used as a lookup value in a SQL type Datalink.
For example:
Attribute with Datalink: (SELECT DrawnBy FROM Drawings WHERE DwgID = {DwgID})
Here the Keyword Datalink {DwgID} is being used as the value to search for in the DwgID field of the Drawings list.
Attaching Datalinks to Attributes in AutoCAD
Open the Template, Seed or Drawing File using the Open options on the List Tools tabs as this ensures the AutoCAD VBA (Visual Basic for Applications) program is loaded into AutoCAD. If the 'AVEVA Electrical' tools menu is not visible the menu has not yet been changed, so select the appropriate AutoCAD menu from wherever AVEVA Electrical was installed. Refer to the Assign Datalinks to Templates and Seed Files for more information.
Editing Datalinks in AutoCAD
Refer to the Assign Datalinks to Templates and Seed Files for more information.
Auto-Erase Block in AutoCAD using Datalinks
Electrical Designer provides an 'Auto-Erase' (or auto-delete) function where a block will be automatically erased from a drawing if a specific Datalink returns nothing. If a Datalink attribute is prefixed with <DEL> and AVEVA Electrical evaluates the following Datalink with nothing (no value) then Electrical Designer will erase the block containing the <DEL> Datalink.
For example, it is required to erase a block if there is no tag number for {TAG10}. Entering: <DEL>{TAG10} in for an attribute in a block will tell AVEVA Electrical to erase the block if {TAG10} evaluates to nothing (i.e. there is no TAG10 for this drawing).
Forcing Uppercase Text in AutoCAD
Electrical Designer provides a method to change any Datalink values retrieved from the AVEVA Electrical database to uppercase. For example, the database value for {Client} may be 'Xyz Oil Company’. To force this to become 'XYZ OIL COMPANY' prefix the Datalink attribute with <UCASE> and it will update to uppercase. If both the <DEL> operator (see above) and the <UCASE> operator are required, then <DEL> must be the first within the attribute (e.g. <DEL><UCASE>{TAG1Manufaturer}).
Copying Blocks with Datalinks in AutoCAD
Since Datalinks are defined as Extended Entity Data within AutoCAD, their behaviour is same as Xdata. That is, if a block is copied with Datalinks attached, the Datalinks are copied too. This can drastically reduce data entry when setting up Datalinks.
For example, required Datalinks can be attached to a block that may represent a Field Device. That block can the be copied to as many drawings as required, saving the effort of re-entering the Datalinks each time. Another example is the Title block used in all drawings. Set-up the first drawing with all Datalinks, and once it has been tested, copy that Title Block (which may contain multiple AutoCAD blocks) to the other drawings.
Summary
-
Datalinks are used to define where data comes from in the database and are attached to Attributes as Extended Entity Data.
-
There are two types of Datalinks: Keywords (predefined) and SQL statements (which are user definable).
-
Datalinks can be used to fill in values to a single attribute and they may be nested within each other and/or concatenated within character strings.
-
Datalinks are attached and edited from within AutoCAD by selecting the desired block containing attributes with the menu AVEVA Electrical > Edit Datalinks command.
-
Blocks may be copied with Datalinks within AutoCAD to reduce setup time (and to copy entire drawings).
-
A list of predefined keywords within the Electrical Designer Drawings List for any selected drawing can be viewed by using the Show Datalinks option on the List Tools - Drawings tab (after selecting a drawing in the Drawings List), which opens the Datalinks Window.