Language Reference Guide : System Classes : ArrayObject Class : InsertRow Method
 
Share this page          
InsertRow Method
The InsertRow method inserts a row into the array at the specified row number.
This method has the following syntax:
integer = ArrayObject.InsertRow([rownumber = integer]
          [, rowobject = Object] [, _rowstate = integer])
This method has the following parameters:
rownumber
Specifies the row number for the new row. You can insert a row at the beginning of the array (rownumber = 1), anywhere in the middle of the array, or at the end of the array (rownumber = array.LastRow + 1). If you specify a rownumber larger than this, it will default to array.LastRow + 1.
You cannot insert a row into the "deleted" rows (rows with rownumber 0 or less, created by the SetRowDeleted method).
Default: 1
When you insert a row, OpenROAD renumbers the rows after the inserted row. For example, if you insert a new row at row 10, OpenROAD creates a new row 10, the previous row 10 becomes row 11, 11 becomes 12, and so on.
rowobject
Specifies the object that the new array row is to reference. The object's class must be the same as, or a subclass of, the array's row_class. Specifying an object of a type different from these is not supported.
If you do not specify an object, OpenROAD inserts a default object of the type specified by the array's row_class.
_rowstate
Specifies a value for the new row's _RowState attribute. For the system constant settings available for this attribute, see RowState Settings.
Default: RS_UNCHANGED
The InsertRow method returns ER_OK if the row was successfully inserted or ER_OUTOFRANGE if the rownumber is 0 or less. Descriptions of system constant values and their numeric equivalents are listed in Error Codes.
For more information about adding rows to arrays, see the Programming Guide.