GetIndexByTime - method of object tvPoints


Searches for the index of the data point according to specified parameters. The index value that is returned by the method, depends on the nIndexType parameter and refers either to the whole buffer of only to the visible part of the buffer.

The vTime time expected according to setting the TrendsView.TimeSetType property, i.e. "local time", "standard time" or "daylight-saving time".

GetIndexByTime(vTime As Variant, nStyle As Variant, nIndexType As Long) As Long
n = oPoints.GetIndexByTime(vTime, nStyle, nIndexType)
vTime(Variant) Time whereby the data point has to be searched
nStyle(Variant) Definition of the data point owing to the vTime time
0 - the point whose time is less 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 Values:
The method returns the index of the found point or -1 if no point has been found.
Let's have the buffer with 100 data points in total, 50 of them are displayed by the viewer and the index of the first displayed point is 7. Suppose that the method finds the 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 in the "local time" (the "standard time" in the standard season and the "daylight-saving time" in the daylight-saving season.):
oTView.TimeSetType = 1
nIndex = oPoints.GetIndexByTime(vTime, 0, 0) 'vTime is "local time"
Time has to be entered as the "standard time" even in the daylight-saving season:
oTView.TimeSetType = 2
nIndex = oPoints.GetIndexByTime(vTime, 0, 0) 'vTime is "standard time"
PROMOTIC 8.3.21 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice