Update cookies preferences
Promotic

GetIndexByTime - method of the tvPoints object

Description:
Search for index of data point according to specified parameters.
Syntax:
Long GetIndexByTime(Variant vTime, Variant nStyle, Long nIndexType)
Parameters:
vTime(Variant) Time whereby the data point has to be searched
The time is expected according to setting the PmgTrendViewer.TimeSetType property, i.e. "local time", "standard time" or "daylight-saving time".
nStyle(Variant) Specifies the data point with respect to the vTime time
0 - the point whose time is less then or equal vTime
1 - the point whose time is greater or equal vTime
2 - the point that is the closest to the vTime time
nIndexType(Long) Required type of the returned index
0 - Index refers to the beginning of the buffer
1 - Index refers to the first data point that is displayed by the buffer viewer
Return value:
The method returns the index of the found point or -1 if no point has been found.
Note:
This method is also functional in Web panels.
 
The index value that is returned by the method, depends on the nIndexType parameter and refers either to the whole buffer or only to the visible part of the buffer.
See also:
- tvTrend.Points (property)
Example1:
Let's have the buffer with 100 data points in total, 50 of them are displayed in the viewer and the index of the first displayed point is 7. Suppose that the method finds first point that suits the vTime time according to nStyle and the index of this point is 10. Then on setting nIndexType to 0 the value on the index 10 is returned, on setting it to 1 the value on the index 3 is returned.

Time has to be entered as the "local time" (the "standard time" in the standard season and the "daylight-saving time" in the daylight-saving season).
JavaScriptVBScriptSelect and copy to clipboard

var nIndex, vTime;
var oTView = pMe;
var oPoints = oTView.Trends("t1").Points;

oTView.TimeSetType = 1;
vTime = "...";   // is "local time"
nIndex = oPoints.GetIndexByTime(vTime, 0, 0);
Example2:
Time has to be entered as the "standard time" even in the daylight-saving season:
JavaScriptVBScriptSelect and copy to clipboard

oTView.TimeSetType = 2;
vTime = "...";   // is "standard time"
nIndex = oPoints.GetIndexByTime(vTime, 0, 0);
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.