Tech Note 91 - Using HistData With InTouch and Excel
Tech Note 91 - Using HistData With InTouch and Excel
Tech Note 91 - Using HistData With InTouch and Excel
All Tech Notes and KBCD documents and software are provided "as is" without warranty of any kind. See the Terms of
Use for more information.
Document #: 000642
Created: December 97
Updated: June, 2004
HistData is a utility program that comes with Wonderware® InTouch™. It can retrieve data from
InTouch historical log files via DDE and then write the requested data to csv files. HistData can
not be used alone; another program is required in order to update HistData’s internal database
items. This Tech Note gives an example of how to use HistData with InTouch and Microsoft®
Excel™. In addition, common error messages and problems associated with HistData are
presented with suggested solutions. The appendix at the end of this Tech Note contains detailed
information about the items that are in the HistData internal database.
1. Start WindowMaker and select DDE Access Name from the Special menu to create
a new Access Name. In the Add DDE Access Name dialog box, configure the Access
Name with the settings shown below:
The DDEAccess name is user defined and can be up to 32 characters. The topic name
is also user defined. The DDEApplication/Server Name must be HistData and the
Advise all items option must be selected.
2. Next, create the following DDE tags to generate one csv file that contains the data
from the encrypted log files:
Note The HistData tags and the DDE Access Name will be automatically created if
you use the HistData wizard. Just select the HistData wizard and place the icon on
your window. Double-click the icon and assign a Hist Trend tag (you can click the
suggest button). Click OK to create the HistData tags.
If you want to send the data not only to the csv file, but also to the item called Data
so that it can be accessed from other applications, create the following two additional
tags:
Note If you create and use these tags and then request a lot of information you will
get the error: Too much data requested – shorten the duration or reduce the
number of tags.
The Status button below is linked to a fill color—discrete expression, based on the
tag HDWStatus.
The Write File button below is linked to a fill color—discrete expression, based on the
tag HDWWriteFile.
The Write File button below is also linked to a Touch Pushbutton—Action script.
When clicked, the WriteFile button will generate the csv file.
If the operation was successful, the value of Status will be ON and the color associated with the
ON status will display. If the operation was not successful, the value of Status will be OFF and
the Error Message will display the cause of the failure.
Excel macros can be written to interface with HistData. Here is an example of a macro written
with Excel 5.0VBA (same for Excel 7.0 or Excel 97):
Note that the data that is poked comes from a cell in the Excel spreadsheet1, called Sheet1.
Here is an example of Sheet1 containing the data to be poked:
Click HERE for the InTouch® Histdata Demo application
Possible causes:
The TAGS item does not list any tag that is checked for log data, such as:
HDWTags=”$Date,$Time”. In this case you will get no errors, but the csv file will
also not be created.
The HDWWritefile is incorrectly defined. Make sure the tag is a DdeInteger tag, the
DDEAccess name is correct and the item is WriteFile. Also make sure there is no
scaling where MinEU=MinRaw and MaxEU=MaxRaw.
Problem: The csv file has no data for the requested tags but the Date and Time stamp are
showing.
Possible causes:
There are no records in the log files for the specified date and time. You can trend the
tags using the Historical Trend to see if there are any records showing.
The tagname dictionary has been corrupted. If the HistData items were initialized
successfully (no errors were displayed by the Error item) but a corruption occurred in
the tagname dictionary in the time between the initialization of the HistData items
and the time you set the WriteFile item to 1, then it is possible that HistData could
create a file with no data for the requested tags.
Suggestion:
Reinitialize the HistData items and perform the WriteFile again. Monitor the error messages
displayed by the Error item and also check the WWLogger for error messages. If there is any
problem with the tagname dictionary, an error should appear in the WWLogger, similar to the
following: Error for DDE HistData|Viewstream1!WriteFile : Poke was rejected by the
server. The Error HistData item should also display an error similar to the following: could not
find tagname.x’ or ‘DBDir invalid item’.
Problem: In my WWLogger I have the following message: Error for DDE HistData|
Viewstream1!WriteFile : Poke was rejected by the server.
Possible causes:
This error will be posted in the WWLogger each time the creation of the csv file fails due to errors
in assigning the values to the HistData items. This error may also occur if you try to set the
WriteFile item to 0 (its default value) or if you try to write to the error item. For example, the
following commands will post an error message in the WWLogger: HDWWriteFile=0 or
HDWError=”none”.
Problem: The csv file has only one record when there should be many records. For example, say
that you requested data for 1 hour at 1/2 second intervals, yet the csv file has only one record.
Possible cause:
The interval item may have an invalid format, such as HDWinterval=500ms instead of
HDWinterval=.5s. The duration item may also have an invalid format, such as
HDWDuration=1— (no increment is specified).
Error Message: Too much data requested – shorten the duration or reduce the number of tags
Solution:
This error occurs when you are using the SendData item and too much data is requested. If the
only purpose is to create a csv file with the data from the encrypted log files, then do not use
SendData.
Possible cause:
The directory Files1 does not exist. Also, check the spelling of the path.
Possible cause:
Possible cause:
The directory specified for the DataDir item does not exist. Check the spelling.
Possible cause:
Possible cause:
There are no log files for the requested date in the path that is specified for the DataDir item.
Possible cause:
The requested tag (in this case, TAGX) does not exist in the tagname dictionary. Check the
spelling of the tag.
Possible cause:
Appendix
The Tech Note is published occasionally by Wonderware Technical Support. Publisher: Invensys Systems, Inc., 26561
Rancho Parkway South, Lake Forest, CA 92630. There is also technical information on our software products at
Wonderware Technical Support
back to top
©2012 Invensys Systems, Inc. All rights reserved. No part of the material protected by this copyright may be reproduced
or utilized in any form or by any means, electronic or mechanical, including photocopying, recording, broadcasting, or by
any information storage and retrieval system, without permission in writing from Invensys Systems, Inc.