Tech Note 154 Configuring InTouch To Query Data From IndustrialSQL Server
Tech Note 154 Configuring InTouch To Query Data From IndustrialSQL Server
Topic#: 000816
Created: September 1999
Under FactorySuite™ 2000, InTouch™ has the ability to query and display data logged in IndustrialSQL™ Server in one
of three ways:
This Tech Note provides installation and configuration guidelines for InTouch to query and display data from
IndustrialSQL Server for each of these three methods.
The ActiveTrend object will now appear in the Installed ActiveX controls list.
http://www.icsen.com/technotes/html/T000816.htm 1/23/2012
Configuring InTouch To Query Data From IndustrialSQL Server Page 2 of 11
The ActiveTrend Properties dialog box also provides a way to connect the ActiveTrend object to the IndustrialSQL
http://www.icsen.com/technotes/html/T000816.htm 1/23/2012
Configuring InTouch To Query Data From IndustrialSQL Server Page 3 of 11
Server database by clicking the InSQL Connection tab as shown in figure 3. The object may be connected from both
WindowMaker and WindowViewer. Database connectivity requires a valid node name for the Server (example, InSQL)
and a valid Username and Password for the IndustrialSQL Server Runtime database.
The ActiveTrend object connects to the IndustrialSQL Server database by using the SQL Server Client alias, which was
defined during the InSQL installation to use a Named Pipes connection. (Client aliases may be viewed by selecting
from the Windows NT Start menu Programs/ Microsoft SQL Server 6.5-SQL Client Configuration Utility, then click the
Advanced tab.)
If the ActiveTrend object will connect to an InSQL database on the same computer, enter the "InSQL" alias or the
computer node name in the "Server" field of the Properties dialog box. If the ActiveTrend object will connect to an
InSQL database on a remote computer, enter the node name of the IndustrialSQL Server computer in the "Server" field.
The ActiveTrend object has a wealth of features, including: automatic connection to the database, history and live
displays, define and save curve sets, a tag browser, and view and hide the toolbars at runtime. For more information
on these and other features, see the Wonderware IndustrialSQL Client Tools Guide, Chapter 9.
The InTouch Historical Trend wizard will connect to the InSQL database through a Microsoft SQL Server client alias,
http://www.icsen.com/technotes/html/T000816.htm 1/23/2012
Configuring InTouch To Query Data From IndustrialSQL Server Page 4 of 11
which is automatically installed and configured (under Common Components) when you install InTouch. Specifying the
node name of the IndustrialSQL Server PC where a dialog requests "Servername" or "Data Source" should always
provide the connection to the InSQL database.
Procedure
1. Open an InTouch application in WindowMaker. WindowMaker must create two files in the InTouch application
directory: Dhist.cfg and Histprv.ini. To do this, select Special/Configure/Historical Logging. The Historical
Logging Properties dialog box will appear as shown in figure 4.
Select the Enable Logging checkbox, then click OK. The two files will then be created by WindowMaker. If
InTouch logging is not desired, the Enable Logging checkbox may be deselected and these two files will
remain.
2. Define the Distributed History Provider name by selecting Special/Configure/Distributed Name Manager. The
Distributed Name Manager dialog box will appear as shown in figure 5.
http://www.icsen.com/technotes/html/T000816.htm 1/23/2012
Configuring InTouch To Query Data From IndustrialSQL Server Page 5 of 11
Click on the Distributed History tab. Type in a unique name for the InSQL database connection in the Provider
Name listbox (example, "InSQLData"). Select InSQL Provider, then click the Configure InSQL Provider button. The
InSql History Provider Properties dialog box will appear as shown in figure 6.
3. Type in the node name of the computer for the InSQL Server in the Data Source listbox. Type in a valid InSQL
userid and password in the User and Password listboxes, respectively. (The wwuser account, along with its
password, has sufficient database privileges for InTouch to read data from the InSQL database.
Test the InSQL database connection by clicking the Test button. Then click OK.
4. View the InSQL data during runtime in the InTouch Historical Trend object. InTouch will automatically connect to
the InSQL database when the object's window is opened. InSQL tags may be assigned to pens in the Historical
http://www.icsen.com/technotes/html/T000816.htm 1/23/2012
Configuring InTouch To Query Data From IndustrialSQL Server Page 6 of 11
Trend object by preceding the tagname with the History Provider name and a dot (.) (example,
"InSQLData.tagname"). Pen assignments may also be made using function calls in an InTouch script.
The InTouch demonstration application accompanying this Tech Note (available on the Wonderware Knowledge
Base at www.wonderware.com/support) uses the following Button script to assign an InSQL tagname to a pen
in the Historical Trend object:
This script will also unassign a tagname from the pen if "_None" has been selected for the tagname from the
Listbox.
Note To unassign the pen after a distributed tagname has been assigned to it, you must first assign the pen to a
local InTouch tagname, then reassign it to the tagname None. This tag must be defined in the InTouch application as
tag type TagID.
1. Create a BindList to associate the InSQL Runtime database table columns to InTouch tags.
2. Connect to the InSQL database via and ODBC DataSourceName.
3. Execute the desired query using SELECT statements.
4. Display the query results in a window using InTouch tags.
Note A sample InTouch application shown in figure 10 is used to illustrate how a typical window would be configured
to use the SQLAccess Manager option. Though you can still follow this method without needing the application, the
application is available on the Wonderware Knowledge Base. The Knowledge Base is available exclusively to
Comprehensive Support subscribers. Contact your local Wonderware distributor to learn more about our
Comprehensive Support program.
http://www.icsen.com/technotes/html/T000816.htm 1/23/2012
Configuring InTouch To Query Data From IndustrialSQL Server Page 7 of 11
2. Click either the User DSN or System DSN tab and click on the Add button. The Create New Data Source dialog
box will appear as shown in figure 8.
Select SQL Server as shown in the figure and click Finish. The ODBC SQL Server Setup dialog box will appear
as shown in figure 9.
3. Enter a unique name in the Data Source Name field as shown in figure 9. In the Server field, enter either "InSQL"
http://www.icsen.com/technotes/html/T000816.htm 1/23/2012
Configuring InTouch To Query Data From IndustrialSQL Server Page 8 of 11
or the node name of the computer where the InSQL database is running. Enter "Runtime" for the Database
Name. Make sure the option Generate Stored Procedure for Prepared Statement is not selected as shown in the
figure.
For more information on establishing ODBC connections to SQL Server, see the Wonderware FactorySuite
System Administrator's Guide, Chapter 4 "Configuring ODBC."
The BindList may have as many pairs of Tagname/Column associations as necessary to retrieve and display the
desired data.
Note The tags must be defined prior to creating the BindList. No hot link exists between the BindList definition
window and the tagname dictionary.
http://www.icsen.com/technotes/html/T000816.htm 1/23/2012
Configuring InTouch To Query Data From IndustrialSQL Server Page 9 of 11
3. Display the query results in a window using InTouch tags and graphic objects.
Figure 10 shows a sample application window that displays some retrieved data. Each object has the necessary
scripting to achieve data retrieval. Table 1 at the end of this Tech Note lists the tag definitions used in the scripting.
Figure 10. Sample InTouch Application Window Displaying Retrieved InSQL Data
Based on the sample application shown in figure 10, here's the Window script that's used:
TableName = "AnalogHistory";
BindList = "InSQL_Data";
The Select Tag ComboBox sets the value of the Message tag InSQLTagNameWhereExp from a list of tagnames
contained in a text file to be used in the Select statement.
http://www.icsen.com/technotes/html/T000816.htm 1/23/2012
Configuring InTouch To Query Data From IndustrialSQL Server Page 10 of 11
The First, Previous, Next and Last buttons are used to navigate through the resulting set of data returned from a query.
Here are the Button scripts used for each button:
Here are the tagname definitions for the tags in the sample InTouch application shown in figure 10. to store
configuration data and display returned values in the window
BindList Memory Message Name of BindList that pairs the database column with
the InTouch tagnames.
InSQL_DateTime Memory Message Display of the date and time for the tag value returned by
the query.
InSQL_Value Memory Integer Display of the tag value returned by the query.
InSQL_Quality Memory Integer Display of the quality information for the tag value returned
by the query.
InSQL_QualityDetail Memory Integer Display of the quality detail for the tag value returned by
the query.
ReturnCode Memory Integer Success/Failure code returned from a SQL function call.
N. Venable
http://www.icsen.com/technotes/html/T000816.htm 1/23/2012
Configuring InTouch To Query Data From IndustrialSQL Server Page 11 of 11
The Tech Note is published occasionally by Wonderware Technical Support. Editors: Sabrina Abercromby and Kelly Hauser; Publisher:
Wonderware Corporation, 100 Technology Drive, Irvine CA 92618. There is also technical information on our software products at
www.wonderware.com/support/mmi, our WonderFax fax-on-demand system at (949) 450-5050, and the Comprehensive Support Knowledge
Base.
back to top
http://www.icsen.com/technotes/html/T000816.htm 1/23/2012