DataBasic Reference > Statements and Intrinsic Functions > I > INS Statement

Comment on this topic

Documentation Comments

Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.

Reality V15.0 ()

INS Statement (DataBasic) (m618703+ins_s.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

INS Statement

Inserts an attribute, value or subvalue into a dynamic array.

Note: The INS statement replaces the INSERT intrinsic function.

Syntax

INS char-string BEFORE dyn-array<attr# {,value# {,subval#}}>

Syntax Elements

char-string is a field of characters expressed as a variable name, a dynamic array reference, or a literal enclosed in quotes.

dyn-array is the dynamic array within which the expression is to be inserted.

attr# is the number of the attribute within dyn-array.

value# is the value number within the referenced attribute.

subval# is the subvalue number within the referenced value.

Operation

Dynamic array indices are evaluated as follows:

Example 1

INS 123 BEFORE ITEM<3>

Inserts attribute value 123 before the third attribute in dynamic array ITEM.

Example 2

INS PRICE<3> BEFORE A<X,Y>

Inserts value of attribute 3 in array PRICE before the Y'th multivalue in the X'th attribute in dynamic array A.

Example 3

INS YR*365 BEFORE ORDER<I,J,3>

Inserts value of YR*365 before the third subvalue in the specified multivalue and attribute.

Example 4

IF PART<1,X+2> = 0 THEN 
INS 1 BEFORE PART<1,X+2>
END

If the multivalue is zero, then a new multivalue (1) is created before the indicated multivalue.

In the following examples:

N = ""
S = "1\2\3]11\22]333^A\B\C]AA"
X = "XXX"

Example 5

INS X BEFORE S<0,2,0>

Result = 1\2\3]XXX]11\22]333^A\B\C]AA.

Example 6

INS X BEFORE S<1,-2,-5>

Result = 1\2\3]11\22]333XXX^A\B\C]AA.

Example 7

INS X BEFORE N<1,2,0>

Result = XXX.

RealityV15.0Comment on this topic