DOCX

Using HistData With InTouch and Excel

By Russell Dunn,2014-06-23 21:02
13 views 0
Using HistData With InTouch and Excel

    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.

    Using HistData With InTouch

    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.

    Here is an example of how a configured tag will look:

3. After you created the DDE tags, create a new window called HistData

that looks similar to the following:

    The # symbols are linked to a user input link. For example, the # symbol below has a User Inputs/String type of link to the tagname HDWDataDir. The user inputs link will enable you to change the value of the tags during runtime.

The Status button below is linked to a fill colordiscrete

    expression, based on the tag HDWStatus.

Here is the configuration for the Status button:

The Write File button below is linked to a fill colordiscrete

    expression, based on the tag HDWWriteFile.

    Here is the configuration for the Write File button:

    The Initialize Data button below is linked to a Touch PushbuttonAction script. When pushed , the HistData items will be initialized with the desired values. If necessary, these values can also be changed during runtime by using the User Inputs Links.

    Here is the configuration for the Initialize Data button:

    The Write File button below is also linked to a Touch

    PushbuttonAction script. When clicked, the WriteFile button will

    generate the csv file.

    Here is the configuration for the Write File button:

    4. After all the above items are configured and saved, start HistData

    and minimize it. Next, start WindowViewer and open the HistData

    window. Click the Initialize button, then make changes to the

    HistData items if needed, and click the WriteFile button. 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.

    Using HistData with Excel

    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

    Common Problems With HistData and How to Solve Them

    Problem: No CSV file is created and no errors appear.

    Possible causes:

    ; HistData is not running

    ; 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).

    Common HistData Error Messages With Suggested Solutions

    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.

    Error Message: Could not open file C:\FILES1\HISTDATA.CSV

    Possible cause:

    The directory Files1 does not exist. Also, check the spelling of the path. Error Message: Could not open file C:\FILES\

    Possible cause:

    No CSV file was defined.

    Error Message: DATADIR item invalid.

Possible cause:

    The directory specified for the DataDir item does not exist. Check the spelling.

    Error Message: STARTDATE item invalid

    Possible cause:

    Invalid format sent to the StartDate item.

    Error Message: No log files found

    Possible cause:

    There are no log files for the requested date in the path that is specified for the DataDir item.

    Error Message: Could not find tagname TAGX in database

    Possible cause:

    The requested tag (in this case, TAGX) does not exist in the tagname dictionary. Check the spelling of the tag.

    Error Message: Could not find tagname .x in: C:\IT6.0B\HISTEST

    Possible cause:

    The file tagname.x does not exist or it has been corrupted. Appendix

    The following items are in the HistData database:

Report this document

For any questions or suggestions please email
cust-service@docsford.com