COM - dpGetPeriod()

Returns the values of data point attributes over a specific period.

Synopsis

HRESULT dpGetPeriod([in] DATE dtFrom, [in] DATE dtTo, [in] long lCount, [in] VARIANT vDpName, [out] VARIANT *vValues, [out] VARIANT *vTimes, [out] VARIANT *vTypes);

Parameter

Parameter Description
dtFrom Start time
dtTo End time
lCount Number of values before and after the period.
vDpName Data point attributes whose values are read.
vValues Variables the values are written to.
vTimes Source times belonging to vValues.
vTypes Field containing the event types.

Description

Returns all values within a period dtFrom to dtTo in the parameter vValue.

The type of vValue depends on the type of the data point attribute. If a data point does not exist, a runtime error is shown.

If several data point attributes are queried, the result is returned as two nested one dimensional arrays since different number of values can be returned for each data point. This also applies to vTimes and vTypes.

If only the data point is specified, :_offline.._value is added.

See also CTRL function dpGetPeriod().

EXAMPLE

(See ComSample.xls, CComSample)

Public Sub dpGetPeriod()
Dim dtFrom As Date
Dim dtTo As Date
Dim vValue As Variant
Dim vTime As Variant
Dim vType As Variant
Dim i As Integer
'Testdaten setzen
dtFrom = Now
For i = 1 To 10
moComManager.dpSet "ExampleDP_Trend1.", (42 / i)
Application.Wait (Now + TimeValue("0:00:01"))
Next i
dtTo = Now
'Werte aus dem Zeitraum abfragen
moComManager.dpGetPeriod dtFrom, dtTo, 0, "ExampleDP_Trend1.",
vValue, vTime, vType
If Not IsEmpty(vValue) Then
If IsArray(vValue) Then
For i = 0 To UBound(vValue)
Debug.Print vValue(i), vTime(i), vType(i)
Next i
End If
End If
End Sub

Assignment

COM