nType | (Long) Connection type
0 - vServer, vGroup, vItem parameters are not taken into account and instead of of them the connection is made according to setting the properties: ConnectionType, ConnectionServer, ConnectionGroup, ConnectionItem, ConnectionUser, ConnectionPassword.
1 - Local connection, the connection to the trend server in the same running PROMOTIC application. All parameters of the method are valid.
2 - Remote connection by the HTTP protocol, the data are sent in the XML format. All parameters of the method are valid. |
---|---|
vServer | (Variant) Remote data source - server.
If nType=0, then the parameter is not taken into account.
If nType=1, then the value of this parameter must be set to the string "local".
If nType=2, then it is the URL address and the value of this parameter must be set by the following text: "http://computer/trend", where:
- computer is usually the name of the remote computer
- trend is the value of the "PmaWebFolder > WebFolder > Web component identifier" configurator or of the "PmaTrendGroup > Web server > Web component identifier" configurator in the application on the computer computer. |
vGroup | (Variant) Group in the remote data source - trends server (the ID of this group).
If nType=0, then the parameter is not taken into account.
If nType=1, then the value of this parameter needs to be set, for example, to the string "group1", where group1 is the value on the server in the "PmaTrendGroup > Trend > Trend group identifier" configurator.
If nType=2 and at the same time the trend item in the vServer parameter is:
- value of the "PmaWebFolder > WebFolder > Web component identifier" configurator,
then the value of this parameter needs to be set, for example, to the string "group1", where group1 is value of the "PmaTrendGroup > Trend > Trend group identifier" configurator. - value of the "PmaTrendGroup > Web server > Web component identifier" configurator,
then the value of this parameter needs to be set to the empty string "". |
vItem | (Variant) Name of the variable in the group of the trends server. See variable names on the "PmaTrendGroup > Data" tab. |
sParam | (String) Connection parameters.
The "iniread=xxx" string is entered, where xxx string is any of min, max, unit, color, name strings, or combination separated by comma. For example "iniread=min,max,color". These values are transferred by calling a method from data extension ExtTrend and set to the viewer. If the parameter is not used, then it is necessary to set an empty string "". |
vUser | [optional] (Variant) User name.
It is entered only if the trends server requires checking the access by the user and the password, see setting the user and the password in the "Trends" configuration window. The vUser parameter needn't be entered if parameter nType=1 or 0 and property ConnetionType=1, i.e. the Connect method is connected to the local server. |
vPassword | [optional] (Variant) User password.
It is entered only if the trends server requires checking the access by the user and the password, see setting the user and the password in the trends server - the configuration in the "Trends" configuration window. The vPassword parameter needn't be entered if the parameter nType=1 or 0 and the property ConnetionType=1, i.e. the Connect method is connected to the local server. |
var bTrend = oTrend.Connect(nType, vServer, vGroup, vItem, sParam);
var bTrend = oTrend.Connect(nType, vServer, vGroup, vItem, sParam, vUser, vPassword);
var oTView = pMe.Items("../TrendView");
var oTrend = oTView.Trends("t1");
if (oTrend)
{
var bConnect = oTrend.Connect(1, "local", "group1", "a1", "");
if (bConnect)
{
// OK
}
}
var oTView = pMe.Items("../TrendView");
var oTrend = oTView.Trends("t1");
if (oTrend)
{
var bConnect = oTrend.Connect(2, "http://computer/trends", "group1", "a1", "");
if (bConnect)
{
// OK
}
}
var oTView = pMe.Items("../TrendView");
var oTrend = oTView.Trends("t1");
if (oTrend)
{
var bConnect = oTrend.Connect(2, "http://computer/historical1", "", "a1", "");
if (bConnect)
{
// OK
}
}