AppendItem method: Collection class

Syntax

AppendItem(&Elem)

Description

Use this method to append an element as the last element of the collection. The item must be instantiated first by using the CreateItem method.

Parameters

Parameter Description

&Elem

Specifies the element to be appended as an object: a Collection object, a Compound object, or a Primitive object.

Returns

A Boolean value: True if the append was completed successfully, False otherwise.

Example

The following example demonstrates how to use Collection and Compound methods to create, populate, and append a compound item within a collection:

Local DocumentKey &DOCKEY;
Local Document &DOC;
Local Compound &COM, &Com_Rdr;
Local Collection &Coll_Rdr;
Local Primitive &PRIM;

&DOCKEY = CreateDocumentKey("FlightStatus", "FlightData", "v1");
&DOC = CreateDocument(&DOCKEY);

&COM = &DOC.DocumentElement;

&Coll_Rdr = &COM.GetPropertyByName("RdrCollection");

&Com_Rdr = &Coll_Rdr.CreateItem();

&PRIM = &Com_Rdr.GetPropertyByName("QE_ACNUMBER");
&PRIM.Value = 105;
&PRIM = &Com_Rdr.GetPropertyByName("QE_AZIMUTH");
&PRIM.Value = "40";
&PRIM = &Com_Rdr.GetPropertyByIndex(3);
&PRIM.Value = "4B";

&nRet = &Coll_Rdr.AppendItem(&Com_Rdr);