Promotic

GetState - method of the PmgTrendViewer object

Description:
Returns viewer state according to the request specified in the nType parameter.
Syntax:
Long GetState(Long nType)
Parameters:
nType(Long) Specifies the state mask, i.e. the viewer state that will be returned by calling the method. It is possible to enter even the combination of values, for example 2+4.
1 - Test whether at least one of tvTrend objects isn't connected to data source (e.g. the tvTrend.Connect method hasn't been called).
2 - Test whether at least one of tvTrend objects is connected to data source (e.g. by calling the tvTrend.Connect method) and it has data ready (former requests to the data, for example when moving the time scale, have already been processed).
4 - Test whether at least one of tvTrend objects is connected to data source and it waits for the data (the data from server haven't come).
8 - Test whether at least one of tvTrend objects has tried to connect to data source (to the variable in the PmaTrendGroup object) (e.g. by calling the tvTrend.Connect method) and this failed by error (connection of the object failed).
16 - Test whether at least one of tvTrend objects is connected to data source, has been waiting for the data but these haven't come (waiting ended by the timeout, see: DataTimeout).
32 - Test whether the range of the time axis hasn't been extended so that it wouldn't be possible to read all required data from this range. See: PointsMaxVisibleCount.
Return value:
The method returns the bit combination of values that refers to the viewer state according to the request specified in the nType parameter. If the value, for example, 4 is set in nType, then (if the viewer is in the corresponding state) it returns 4, otherwise returns 0.
Note:
This method is not functional yet in Web panels.
See also:
- tvTrend (object)
Example1:
The state of the trend viewer is checked whether some of trends (of tvTrend objects) is currently waiting for the data.
JavaScriptVBScriptSelect and copy to clipboard

var oTView = pMe;
if (oTView.GetState(4) == 4)
{
// ... some of trends is waiting for the data from server
}
Example2:
The state of the trend viewer is checked whether some of trends is currently waiting for the data (value 4) and whether waiting at some of objects was finished by the timeout (value 16). The value 20 is the sum of 4+16.
JavaScriptVBScriptSelect and copy to clipboard

var oTView = pMe;
var nState = oTView.GetState(20);

if (nState == 20)
{
// ... some of trends is waiting for the data from server and, at the same time, wating at some of objects was finished by the timeout.
}
else if (nState == 16)
{
// ... none of trends is waiting for the data from server but waiting at some of trends was finished by the timeout, i.e. the viewer has the data ready (but not all of them) and probably it will not get the remaining data.
}
else if (nState == 4)
{
// ... some of trends is waiting for the data from server.
}
else
{
// ... nState = 0 none of trends is waiting for the data and waiting at none of trends was finished by the timeout, i.e. the viewer has already got all data and they are ready.
}
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

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