Update cookies preferences
Promotic

Add - method of the PmaSequencer object

Description:
Adds new item into the queue.
Syntax:
Boolean Add(Variant Timeout, [Variant Val1], [Variant Val2], [Variant Val3], [Variant Val4], [Variant Val5], [String Params])
Parameters:
Timeout(Variant) Specifies when the item is released and thus when the onStep event is triggered (if it doesn't occur sooner by the Release method).
 
If it is the numeric value (of Integer, Long, Single, etc. type), then it means the number seconds after which to release the item (0=doesn't wait, -1=wait for infinite time).
The meaning of this value depends on setting of the "Type of item start" configurator on the "Sequencer" tab:
If set the "0 = items start independently, each according to its timeout", then it is the time from calling Add method.
If set the "1 = items start chronologically, timeout is delay between them", then it is the time since releasing the last item. In this case the defined timeout must be less then or equal to 21 days (i.e. 1814400 seconds).
Possible change of the computer time has no influence to the timeout of items, i.e. the number seconds is observed till the start.
 
If it is the value of the Date type, then it is the date and time when to release the item. The Date type cannot be set if set the "1 = items start chronologically, timeout is delay between them". Possible change of the computer time has no influence to the absolute time of starting the items. The items are started in the set absolute time (according to the new time). For example, the item that had to be started in 14:00:00, is started in 14:00:00 of the new time.
Val1[optional] (Variant) 1st value of the item. This value can be set for the next usage in the onStep event.
Val2[optional] (Variant) 2nd value of the item. The usage see Val1.
Val3[optional] (Variant) 3rd value of the item. The usage see Val1.
Val4[optional] (Variant) 4th value of the item. The usage see Val1.
Val5[optional] (Variant) 5th value of the item. The usage see Val1.
Params[optional] (String) Additional parameters of the created item. If the Val4 parameter or Val5 parameter are used, then the last Params parameter is mandatory. see: Example1. Entries are in the KeyVal format, for example thread:main;.
"thread:xxx;" - Specifies the thread where the onStep event is triggered for this item. This option is relevant only if the PmaSequencer object uses the work thread (see the "Used thread" configurator), otherwise is ignored. The usage of this option see the PmaSequencer object and How to start selected scripts in another thread.
"thread:work;" (default) - Event is triggered in the worker thread.
"thread:main;" - Event is triggered in the main thread.
"pos:xxx;" - Specifies, whether the item is placed to the end or To the beginning of the queue. This option is relevant only if in the "Type of item start" configurator on the "Sequencer" tab "1 = items start chronologically, timeout is delay between them" is selected.
"pos:last;" (default) - The item is queued to the end of the queue.
"pos:first;" - The item is placed To the beginning of the queue (ahead of all pending items).
"timeout:xxx;" - Allows to set the meaning for the Timeout parameter. In the JavaScript language the data type Date does not exist, which is used to distinguish between timeout (TimeSpan) and date (DateTime).
"timeout:date;" - Specifies that the number in of the Timeout parameter will represent a date (just like the Date data type).
Return value:
true - Item has been added.
false - Item hasn't been added. The reason: if the maximum number of items has been exceeded (see the MaxSize property) or the Timeout parameter is set badly. This is written into the global errors in the INFO system.
See also:
Example1:
Possible variants of calling the method from the point of view of specifying optional parameters. If the Val4 parameter or Val5 parameter are used, then the last Params parameter is mandatory.
JavaScriptVBScriptSelect and copy to clipboard

var oSeq = pMe.Pm("/Sequencer");
var t, val1, val2, val3, val4, val5, params;
oSeq.Add(t);
oSeq.Add(t, val1);
oSeq.Add(t, val1, val2);
oSeq.Add(t, val1, val2, val3);
oSeq.Add(t, val1, val2, val3, params);
oSeq.Add(t, val1, val2, val3, val4, params);
oSeq.Add(t, val1, val2, val3, val4, val5, params);
Example2:
Into the object we add an item that is released after 10 seconds:
JavaScriptVBScriptSelect and copy to clipboard

var oSeq = pMe.Pm("/Sequencer");
oSeq.Add(10, "ID1");

History:
Pm9.00.25:
- New option "pos:xxx;" allows to specify where the new item is queued.
- New option "timeout:xxx;" allows to specify where the new item is queued.
- New Val4 parameter and Val5 parameter.
Pm9.00.08: The Params method always returned false by mistake in previous PROMOTIC 9.0.X versions.
Pm8.00.03: New Params parameter
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

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