Promotic
Login logon

Preconfiguration "General asynchronous methods"

This preconfiguration can be activated when creating a new object (e.g. by "New object ..." in the context menu of the object or by pressing the Insert key after selecting the object).
 
This preconfiguration is included in the "/ Technology" group.

- The preconfiguration creates an object of the PmaFolder type. The main object name is preconfigured to "Async".
- The preconfiguration is created including the panel (object of the PmaPanel type) is functional also as Web panel.


The preconfiguration allows to create and use designer methods that will be executed asynchronously in the PmaSequencer object on the "Methods" tab. Here, the preconfiguration has created a template designer method Example1.

In the PmaFolder object there are two system designer methods CallMethod and CallGetResult. These are used as interfaces for using designer methods.
Parameters of the "CallMethod" method:
sMethod - designer method name
aPars - the array of parameters of designer method
vCallback - the way of returning the value
null - not required
callback function name - name of the function where the return value will be sent
0 - returned by calling the "CallGetResult" method


The created panel also has two designer methods with the same name and contains a button (PmgButton). In the button script, there is an example of how to asynchronously get the return value from the designer method.

In the beginning of the "CallMethod" method script of the PmaFolder object the examples of calling the designer method Example1 are in the comments.
These configurators can be set before the preconfiguration is created:
The name of created objectName of the object created in the Pma object tree.
The maximum name length is 30 characters.
This is a system name, so it must contain only alphanumeric and must not contain any diacritics (i.e. national dependent characters), empty string, spaces and first character must not be a number.
Default: "Async"
Example1:
The example of using the asynchronous method without return value in the application script.
JavaScriptSelect and copy to clipboard

pMe.Pm("Async").Methods.CallMethod("Example1", Pm.CreatePmArray().Array1("wait", 5000), null);
Example2:
The example of using an asynchronous method with a return value in the callback function.
JavaScriptSelect and copy to clipboard

function onReturn(ev)
{
Pm.Debug("result");
}
pMe.Pm("Async").Methods.CallMethod("Example1", Pm.CreatePmArray().Array1("wait", 5000), onReturn);
PROMOTIC 9.0.34 SCADA system documentation MICROSYS, spol. s r.o.

Send page remark Contact responsible person
© MICROSYS, spol. s r.o.Update cookies preferences