With VTS as a DDE server, you can display values such as tag names, I/O devices, or other data in the cell(s) of an Excel™ spreadsheet. The process is fairly simple, and does not require the creation of a DDE tag (DDE tags are used when VTS is configured as a DDE client, either locally, or on the network – see VTS as a DDE Client). Formulae with three parts and a series of delimiters are used to display specific pieces of data in specific cells. The three parts comprising a formula are: the name of the program; the file name or topic within the program; and, the cell range, value, field, or data that's referred to. The example below shows the syntax of a remote reference formula and the required delimiters (separator characters).
=VTS|Display!TagName\Variable
The above formula is not literal; it displays the basic structure of the formula that is to be placed within the cell of an Excel spreadsheet. The structure is detailed in the table below.
= The equals sign (=) indicates to Excel that a formula is to follow in the selected cell.
VTS "VTS" is literal, indicating that VTS is the name of the program from which the data you wish to report in this cell originates.
| The pipe character (|) is the program topic delimiter, separating the program name from the document or topic name.
Display Following the pipe character is the document or topic name. In the case of VTS, this should be the Display Manager's title. By default, the title for the Display Manager is set to "Display".
If you've specified a custom Display Manager title using the application's Config.ini configuration file, enter it in this section of the formula (see the Display Manager Title section below this table for details). Otherwise literally enter "Display" in this section of the formula.
Note: If the title you've specified for the Display Manager has spaces in it, you must use single quotes to surround the title (see the "Use of Single Quotes" section below this table).
! The exclamation point character (!) is the topic item delimiter, separating the document or topic name from the cell range, value, field, or data to which you are referring.
TagName Following the exclamation point character should be the name of the tag whose data you wish to be reported in the spreadsheet cell. The tag name should appear exactly as it is displayed in the name property of the tag properties folder.
Note: If the tag name you've specified has spaces in it, you must surround the TagName\Property portion of the function with single quotes (see the "Use of Single Quotes" section below this table).
\ The back slash character (\) is the scope operator, separating the tag name from the property or data to which you are referring.
Variable The name of one of the tag's variables whose value you wish to be reported in the cell; for example, "Name", "Area", "Description", or "I0device". You may also use "Value" if you wish to report the actual value of the tag. For your information, variable names for each tag type have been listed in "VTS Developer's Guide: 7: Databases: Tag Properties Database (Points.mdb)".
Formula Examples
The following formula examples have been provided to assist you in setting up Excel™ spreadsheet cells to read values from VTS tags.
If you wanted the value of a tag named, "DigitalInput" to appear in a spreadsheet cell, you would enter:
=VTS|Display!DigitalInput\Value
If you wanted to display
the name of the same tag's associated I/O device in a spreadsheet cell, you
would enter:
=VTS|Display!DigitalInput\IODevice
Note: The variable value
(the last value in the formula) must be written exactly as it occurs in the
tag's code. For your convenience, the variables holding the data for each tag
type are listed in "VTS Developer's Guide: Tag
Properties Database (Points.mdb)".
Use of Single Quotes in Formulas
If the name of the application, document, topic, or data item contains spaces or reserved characters such as colons (:) or minus signs ( – ) that have special uses in a formula, the text must be enclosed in single quotation marks.
=VTS|'My Application'!AITag\Description
In the case where spaces appear in the tag name, the entire tag name and variable must be enclosed in single quotes.
=VTS|Display!'Analog Input Tag\Area'
=VTS|'My
Application'!'Analog Input Tag\Value'
Display Manager Title
When entering a formula to display VTS data in a spreadsheet cell, it is necessary to name the document or topic name in which the data appears following the pipe character ( | ). In the case of VTS, the document or topic name is the title given the Display Manager. By default, the Display Manager's title is set to "Display" by VTS. If you have not expressly configured a custom title for the Display Manager, you should literally use "Display" after the pipe character in your formulas as shown:
=VTS|Display!'Analog Input Tag\Area'
However, if you have used the Config.ini "DisplayManagerTitle" variable to specify a title for your application (which is displayed in the Windows title bar that appears above the Display Manager's title bar, IF you've set the "DispMgrFullScreen" variable to "0") it is this title that must be used after the pipe character in your formulae. For example:
[SYSTEM]
DispMgrFullScreen = 0
DisplayManagerTitle = My
Application
If as above, you've specified a name for the Display Manager's title bar, you must use this custom title in the formula specified in the Excel spreadsheet cell in order for your data to be reported in the cell.
=VTS|'My Application'!AI20\Area
As shown in the example above, if the title you've specified for your application has spaces or reserved characters in it, you must surround the title with single quotes (see VTS as a DDE Server).
Displaying Array Data
The client program can use the scope resolution operator and the array index operator to specify the VTS value to get. For example:
=VTS|Power!Data[51]
will return the value of the array element Data[51] in a VTS application whose title is "Power".