Using CitectSCADA > Exchanging Data with Other Applications > Using DDE (Dynamic Data Exchange) > Setting up DDE conversations

Setting up DDE conversations

The DDE protocol itself does not support the launch of applications, so both the DDE Client application and the DDE server application needs to already be running before any DDE conversations can occur (unless the calling application is coded to detect and launch the DDE server application when necessary).

At the beginning of a DDE conversation, a DDE Client requests the services of a DDE server using DDE Client syntax (which contains the DDE server application name, topic or file name, and the data item name in the request). For DDE Client syntax details, see DDE conversations and client syntax.

To set up an application as a DDE Client, that is, to request data from a DDE server application, you need to use appropriate values in the DDE Client syntax as follows:

DDE server application name

The DDE server name is usually the DDE server application name, for example the DDE server name for CitectSCADA is "Citect", the DDE server name for Microsoft Excel is "Excel", the DDE server name for Microsoft Word is "WinWord", and the DDE server name for Microsoft Access is "MSAccess". Most DDE Servers respond to only one name.

DDE Topic name

The DDE Topic name for CitectSCADA is either "Data" (if you use the Cicode DDE functions) or "Variable" (if you use CitectSCADA as the DDE server and want to access the variable tag database directly). The DDE Topic name for Microsoft Excel is the name of the worksheet (which may also include the workbook name enclosed in square brackets). The DDE Topic name for Microsoft Word is the document name. The DDE Topic name for Microsoft Access is the Database name and Table name, Query name or an SQL string as detailed in the following note:

Note: The proper DDE Client syntax of the DDE Topic name section for accessing a Microsoft Access database is constructed like this: "<DataBaseName>; TABLE <TableName>".

The <DataBaseName> placeholder is for the name of the Access database file followed by a semicolon ( ; ). You might have to include the file path; however this might not be the case (i.e. if it is known that Access will be running with the target file open). The .MDB suffix is optional (as .MDB is the default suffix for Access databases), unless the full path was included.

The TABLE <TableName> is the command string to instruct Access which table data you intend to converse with. DDE also supports the use of QUERY <QueryName> or SQL <SQLString> in place of TABLE <TableName>.

The use of the semi-colon ( ; ) after the '<DataBaseName>' placeholder, and the use of UPPERCASE for the 'TABLE', 'QUERY', and 'SQL' commands in the DDE string syntax are necessary. The whole section needs to be enclosed in quotes ( " ).

DDE Data item name

The DDE Data item name for CitectSCADA depends upon the DDE Topic name being used. When using 'Variable' as the DDE Topic name to access the variable tag database directly, the DDE Data item name is the CitectSCADA variable tag name. When using 'Data' as the DDE Topic name to access a value posted using the Cicode DDEPost() function, the DDE Data item name is the posted name.

The DDE Data item name for Microsoft Excel is the cell range in Row number Column number format (for example R1C1). The DDE Data item name for Microsoft Word is a bookmark name. The DDE Data item name for Microsoft Access is dependant upon which topic name was used. Refer to the Microsoft Access Help for details.

Note: These CitectSCADA DDE help topics and examples were originally written for Windows 3.xx and subsequently updated for Office 95 on Windows 95. Microsoft has since introduced security measures with Office 2000 and later versions which, by default, block Office applications from being DDE Clients. For security details, see Using DDE with Microsoft Office applications.

CitectSCADA can perform as both a DDE server and as a DDE client as necessary. To set up CitectSCADA to use DDE, see Exchanging CitectSCADA data via DDE.

CitectSCADA comes with an Excel workbook file which contains macros to help you insert correct DDE Client syntax links from your CitectSCADA runtime project tag database directly into an Excel worksheet.