| INS | Index Level | INT |
| 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 ) |
| Category | BASIC |
| Type | Function |
| 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". |
| Options | |
| See Also | statements & functions LOCATE dynamic array array references DELETE ac.expression DEL vc.expression string expressions INS assignment EXTRACT REPLACE array.variable functions sc.expression |
| 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. |
| Warnings | |
| Compatibility | D3 7.0 AP R83 |
| INS | Index Level | INT |