HTGetLastError() Function
- Last UpdatedFeb 22, 2017
- 1 minute read
The HTGetLastError() function can be used in a script to determine if an error occurred during the last data retrieval for a specified historical trend pen.
Category
Historical
Syntax
[Result=]HTGetLastError(Hist_Tag,UpdateCount, PenNum);
Arguments
Hist_Tag
HistTrend tag assigned the name of the trend.
UpdateCount
Integer representing the trend's .UpdateCount dotfield.
PenNum
Integer tag or value representing the pen number (1-8) of the trend.
Result
Integer assigned to a tag that represents the status of the last script function call for the specified pen.
0 = No error
1 = General server error
2 = Old request
3 = File error
4 = Server not loaded
5 = Trend/Pen passed in function does not exist
6 = Trend tag does not exist in database
7 = Pen number passed to function is invalid (not in range of 1 to 8).
8 = No tag or a non-logged tag assigned to the pen number
Examples
The following statement retrieves the status of the last data retrieval for pen 3 of the Trend1 trend and assigns the result to the ResultCode integer tag.
[ResultCode=]HTGetLastError("Trend1", Trend1.UpdateCount,3);
In an animation Analog Value Display QuickScript the following statement would be used:
HTGetLastError("Trend1",Trend1.UpdateCount,3);