INSERT

INSERT

INSERT action


Function

The action inserts one or several rows into specified structure.

Declaration

INSERT _struct, beforeIdx, rowsToInsert

[, lastRow]

Parameters

struct

in/out

Whole structure identifier where the row will be inserted to.

beforeIdx

in

Identifier of Int type. Inserted row will be inserted before the row specified in this parameter.

rowsToInsert

in

Whole structure identifier or one row identifier - row(s) to insert.

lastRow

in

Optional parameter - one row identifier.

 

Description

The action inserts:

  • row, if rowsToInsert is the reference to an structure row, or

  • rows (whole structure) if rowsToInsert is the reference to a whole structure

Inserting will be performed into the local structure _struct before the row given by the parameter _beforeIdx. If _beforeIdx = _struct\DIM+1 or _beforeIdx = -1, the action will insert the given row(s) in the end of the structure (append). If the value of the parameter  _beforeIdx different, the action ill generates the error _ERR_RANGE_ERROR. The structures _struct and rowsToInsert must be the same type.

If the parameter lastRow is used, the action will copy the source structure rows determined by the parameters rowsToInsert and lastRow. In this case both the parameters must represent a row of the same structure.

 

Example:

RECORD (SD.RecordDef) _struct RECORD (SD.RecordDef) _rowsToInsert INT _beforeIdx REDIM _struct[10] REDIM _rowsToInsert[2] ; inserting 1st row in the beginning INSERT _struct, 1, _rowsToInsert[1] ; inserting 2nd row at the end _beforeIdx := _struct\DIM+1 INSERT _struct, _beforeIdx , _rowsToInsert[2] ; inserting the whole structure rowsToInsert in the beginning INSERT _struct, 1 , _rowsToInsert

 

Example 2

Inserting the 1st and 2nd rows of the structure _rowsToInsert at the beginning of the structure _struct.
 

 

INSERT _struct, 1, _rowsToInsert[1], _rowsToInsert[2]

 


Related pages:

Script actions