Previous Topic

Book Contents

Book Index

Next Topic

Listing Collections

You can list through collections and read its objects in a similar way to listing containers.

To get items by their order number:

ApiBOCollection.item(int), ApiBOCollection.get(int), ApiCollection.item(int), ApiCollection.get(int)

Returns item by the specified order number. The numbering of items in the collection starts with 0. There is no difference in function between these two methods.

To find out a number of items held by the collection:

ApiBOCollection.length(), ApiCollection.length()

Returns number of objects held by this collection.

You can determine a position of a specific BO within the collection using:

ApiBOCollection.indexOf(BusinessObject), ApiCollection.indexOf(BusinessObject)

Returns order number (position) of the first instance of a given business object (Business object is an entity in an information system bearing some information. In Valuemation, all Valuemation objects are called "business objects") in the collection. You pass the business object you are asking for as a parameter.

To check whether a collection contains a specific BO:

ApiBOCollection.contains(BusinessObject), ApiCollection.contains(BusinessObject)

Returns TRUE if the business object passed as a parameter is contained in this collection. Otherwise, returns FALSE.

To find out whether a collection is empty:

ApiBOCollection.isEmpty(), ApiCollection.isEmpty()

Returns TRUE if this collection is empty, in other cases returns FALSE.

Example - Check whether the person belongs to a particular department

You might want to ask, whether the person belongs to a particular department, therefore you call:

oDepartment.getBOFields.find(“persons”).contains(oPerson)

In the code, oPerson is the person you ask for. This method returns TRUE if the person is held by the given collection (collection of persons belonging to this department).

See Also

Collections

N to M Relations

Creating Collections

Time-related Feature

Adding Objects to Collections

Appending BOCollections to Collections

Merging BOCollections

Removing Objects from a Collection

Sorting Collections