Update cookies preferences
Promotic

CreateFilter - method of the PmaTrendGroup object

Description:
Creates the value of the filter range for next methods.
By calling the method the value with query parameters for the GetData method is created.
Syntax:
Variant CreateFilter(Date tFrom, Long nFromType, Date tTo, Long nToType, Long nPoints)
Parameters:
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.
Note:
The parameters tFrom, tTo can be created by calling the GetDateOf method. Thus it is possible, for example, to enter the time in the GetDateOf method as the input parameter and to find out the time so as the tFrom, tTo define for example the beginning (time 00:00) and the end (time 24:00) of the day into which thus assigned time belongs.
See also:
Example1:
Detects the trend data in the time range <current time - 1 hour, current time>. Time values are in the aTime array and values of the a1 variable are in the aData array.
JavaScriptVBScriptSelect and copy to clipboard

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));
}
Example2:
Detects the trend data in the range of 1000 points before the current time. Data values are in the aData 2-dimensional array.
JavaScriptVBScriptSelect and copy to clipboard

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));
}
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

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