DataBasic Reference > Statements and Intrinsic Functions > Special Methods > %Array (for Connection Objects)

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.

RealityV15.1Online Documentation (MoTW) Revision 7

%Array Special Method for Connection Objects (databasic_sp_method_array_connection.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

%Array Special Method for Connection Objects

This method is used with a connection object to create an array of primitive types on the language server and return a reference to it.

Syntax

%Array(Type, Initialiser1 {, Initialiser2{, ...}})

%Array(Type, DynamicArray)

Syntax Elements

Type Java primitive type (string, int, float, bool, etc.)
Initialiser1 A suitable initialiser for Type
DynamicArray An attribute mark delimited list

Examples

Var = %Array(int, 1, 2, 3, 4)

Create an array of ints initialised to 1, 2, 3, 4. This is equivalent to the Java syntax:

int[] Var = new int[] { 1, 2, 3, 4 };

The following is the equivalent statement using a dynamic array:

Init = "1^2^3^4"
Init = CHANGE(Init, '^', @AM)
Var  = SecondCon->%Array(int, Init)

Initialise a dynamic array and then use it to create an array of ints initialised to 1, 2, 3, 4 on SecondCon.

Notes

Such arrays of primitive objects are often needed as parameters to Java methods, and this is the only way to create a suitable object.

See Also

Special Methods

%New

%Class

RealityV15.1 (MoTW) Revision 7Comment on this topic