basic.insert Function/BASIC Program

basic.insert

Command basic.insert Function/BASIC Program
Applicable release versions: AP, R83
Category BASIC Program (486)
Description inserts the element referenced by "string.expression" into a specific attribute, value, or subvalue location in "dynamic.array.expression".

"-1" may be specified as the "ac.expression", "vc.expression", or "sc.expression". Position "-1" inserts the expression as the "last" element in the respective location.

"0" (zero) may be specified as the "ac.expression". Position "0" inserts the expression as the "first" attribute. A "0" as the "vc.expression", or the "sc.expression" is ignored.

Unlike the "replace" function, which changes the contents of a dynamic array element without changing the logical position of it or any other element, the "insert" function inserts the results of "string.expression" at the specified location and all following information at that dynamic array level (attribute, value, or subvalue) is shifted one position higher in the array. If an "ac.expression" of 1 is specified, the expression is inserted before attribute 1, shifting attribute 1 to attribute 2.

The "insert", "replace" and "delete" functions force the entire dynamic array (string) to be rebuilt. See "dynamic array".
Syntax insert(dynamic.array.expression, ac.expression; string.expression)
insert(dynamic.array.expression, ac.expression, vc.expression; string.expression)
insert(dynamic.array.expression, ac.expression, vc.expression, sc.expression, string.expression)
Options
Example
customer.item = insert(customer.item,1,1,0,name)
-or-
customer.item = insert(customer.item,1,1;name)

Both of these examples are axactly the same. They insert the current value of 
"name" in attribute 1 (one) of the array, "customer.item". 
Every other value in attribute 1 "shifts right" by one position. 
(Value 1 becomes value 2, and so on.) The values of attribute one are shifted, 
but the other attributes in the item maintain their relative position.
Purpose
Related basic.statements
basic.locate
basic.array.dynamic
basic.array.references
basic.delete.function
basic.ac.expression
basic.del
basic.vc.expression
string.expressions
basic.ins
basic.assignment
basic.extract
basic.replace
basic.array.variable
basic.functions
basic.sc.expression