tFrom | (Date) Opening time from.
If the value -1 is set, then it isn't used and the range is defined only by the tTo and nPoints parameters. |
---|---|
nFromType | (Long) Type of the opening time from
1 - tFrom is "local time" (the "standard time" in the standard season and the "daylight-saving time" in the daylight-saving season, corresponds to the computer time depending on the locale setting of Windows system)
2 - tFrom is "standard time" (in the daylight-saving and standard season)
10 - The oldest time. In the tFrom parameter is entered the value -1. |
tTo | (Date) Closing time to.
If the value -1 is set, then it isn't used and the range is defined only by the tFrom and nPoints parameters. |
nToType | (Long) Type of the closing time to
1 - tTo is "local time" (the "standard time" in the standard season and the "daylight-saving time" in the daylight-saving season, corresponds to the computer time depending on the locale setting of Windows system)
2 - tTo is "standard time" (in the daylight-saving and standard season)
11 - the newest time. In the tTo parameter is entered the value -1. |
nPoints | (Long) Maximum number of points.
If the value -1 is set, then nPoints is set to value from the "Maximum number of points returned in message by trend server (for one variable)" configurator. If the tFrom, tTo and nPoints parameters are set diverse from -1, then the generated query returns the set of points from tFrom to tTo time but nPoints points as the maximum. |
var tNow, vFilter, aTime, aData;
tNow = Pm.Time;
vFilter = oTrend.CreateFilter(tNow - 1 / 24, 1, tNow, 1, -1);
aTime = oTrend.GetData("time", vFilter);
aData = oTrend.GetData("a1", vFilter);
if (Pm.IsValid(aTime))
{
Pm.Debug("The time of the first value is " + aTime.GetItem(0));
Pm.Debug("The value of the a1 variable in this time is " + aData.GetItem(0));
}
var vFilter, aData;
vFilter = oTrend.CreateFilter(-1, 0, Pm.Time, 1, 1000);
aData = oTrend.GetData("time;attr;a1;a2;", vFilter);
if (Pm.IsValid(aData))
{
Pm.Debug("The time of the first value is " + aData.GetItem(0, 0));
Pm.Debug("The attribute value in this time is " + aData.GetItem(1, 0));
Pm.Debug("The value of the a1 variable in this time is " + aData.GetItem(2, 0));
Pm.Debug("The value of the a2 variable in this time is" + aData.GetItem(3, 0));
}