Export information from the Trend history file(s) in proprietary binary format ( *.hst ) to a plain text ( *.txt) or comma-delimited ( *csv ) file.

Function Group Execution Windows Embedded Thin Client
HST2TXT File Asynchronous Supported Supported Supported


HST2TXT( strStartDate, strStartTime, numDuration, numGroup, strTargetFile, optStrSeparator, optNumMilliseconds, optStrFormat, optNumInterval )
The start date of the data.
The start time of the data.
Numerical tag containing duration of the data in hours.
Numerical tag containing trend group number.
String tag containing path and name of the file to be written.
Optional The data separator character for file. If omitted, the function uses the TAB character (\t) to separate the values in the text file.
Optional numeric tag. If this parameter is false (0), the text file created will not show milisecond-precision on the timestamp of each history sample.
String tag, which specifies the order of the Month (M), Day (D), and Year (Y) for the time-stamp format exported to the text file:
  • "DMY": Day, Month, Year
  • "MDY": Month, Day, Year
  • "YMD": Year, Month, Day

If omitted, the function uses the format DMY for the timestamp in the text file.

Optional numeric tag specifying the sampling interval. Only line itmes at this interval are written as text to the target file; all other line items in the Trend history are discarded.

For example, if optNumInterval has a value of 10, then only every tenth line item is written out.

Returned value

−3 Invalid number of parameters
−2 Dll functions not found
−1 InStudiot.dll not found
0 Function was executed successfully
1 Error. Previous execution of the HST2TXT has not yet been completed


Tag Name Expression
Tag HST2TXT( "04/14/2002", "06:30:00", 0.1, 3, "C:\Studio\data.txt", "\" )
Tag HST2TXT( "04/14/2002", "06:30:00", 0.1, 3, "C:\Studio\data.csv", "," , "MDY" )
Tag HST2TXT( "04/14/2002", "06:30:00", 0.1, 3, "C:\Studio\data.csv", "," , "MDY", 10 )
Tip: When using the comma character (,) as optStrSeparator, the function creates a file in the CSV format (Comma Separated Values). It is a useful tool for exporting the Trend history data from the proprietary binary format into a file that can be opened with Microsoft Excel.