Promotic

Remove - method of the PmArray object

Description:
Removes one or multiple items from the array. The size of the array is reduced by removed items.
It is functional only for 1-dimensional array.
Syntax:
Empty Remove(Long nPos, [Long nCount])
Parameters:
nPos(Long) The index of the item to be removed.
The -2 value means poslední položku.
nCount[optional] (Long) The number of items to be removed.
If not set, then is 1.
The items are being removed from defined position towards the end of the array.
If the last position of the array is set (-2) then the items are being removed from the end of the array towards the beginning.
Either all selected items are removed or the method fails.
Note:
This method is also functional in Web panels.
Example1:
Removes 2 items from array.
JavaScriptSelect and copy to clipboard

var a = Pm.CreatePmArray().Array1(0, 10, 20, 30, 40);
a.Remove(2, 2);   // Result: (0, 10, 40)
// or
a.Remove(-2, 2);   // Result: (0, 10, 20)
Example2:
Removes empty items from the array.
JavaScriptSelect and copy to clipboard

var a = Pm.CreatePmArray();
var n = 100;
a.Create(n);
a.SetItem("Test1", 0);
a.SetItem("Test2", 1);
a.Remove(2, n - 2);

History:
Pm9.00.04: Created
PROMOTIC 9.0.23 SCADA system documentation MICROSYS, spol. s r.o.

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