Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Insert - method of object PmArray

Description:
Adding one or multiple items in the file. The array is enlarged by the added items.
Syntax:
Empty Insert(Long nPos, Variant vValues, [Long nAttr])
Calling:
a = Insert(nPos, vValues, nAttr)
Parameters:
nPos(Long) The index of an item to be added. The current item on this index and following items will be shifted behind the added items. The value -2 represents the last item.
vValues(Variant) Added value or array of added values.
nAttr[optional] (Long) This parameter defines the behavior if the value of vValues parameter contains 1-dimensional array.
0 (default) - The content of vValues parameter is always added as a single item.
1 - If the vValues parameter contains 1-dimensional array then individual items of such array are added (multiple items are added at once). Otherwise the value of vValues parameter is added as a sigle item.
Note:
The method Insert allows adding items to the beginning, to the end and aslo to the inside of an existing array and the method Remove allows removing items from the beginning, from the end and aslo from the inside of an existing array.
This method is also functional for Web panels.
Example:
Adding item/items in the form of an array a2 (12, 13, 14) into array a (0, 10, 20, 30) to position 2
JavaScriptSelect and copy to clipboard

var a = Pm.CreatePmArray().Array1(0, 10, 20, 30);
var a2 = Pm.CreatePmArray().Array1(12, 13, 14);
a.Insert(2, a2, 0);  //The result will be (0, 10, (12, 13, 14), 20, 30)
//or
a.Insert(2, a2, 1);  //The result will be (0, 10, 12, 13, 14, 20, 30)

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

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice