Previous Topic

Book Contents

Book Index

Next Topic

Sorting Collections

ApiCollection as such enables you to group objects of various object types together in a flexible way. What’s more, for objects of the same type it offers the possibility of automatic sorting by a given attribute, which includes sorting by a number of different data types: strings, numbers and Boolean values, as well as time and date values. Thanks to this feature you no more need to bother with implementing your own sorting methods into your scripts, which is now all done automatically within Valuemation.

To sort objects held by the given collection:

ApiCollection.sort(attributeName, Ascending)

Sorts a collection by the given attribute. Ascending is a Boolean variable, pass TRUE to sort the collection in an ascending order, FALSE to get a descending order. Remember that in order to use this method, all objects held by the collection must be of the same object type, which you can easily check by using the following method so as to prevent exceptions.

To check whether all objects held by the collection match in type:

ApiCollection.isObjectsSameType()

Returns TRUE if all objects in the collection match in type. Otherwise returns FALSE.

See Also

Collections

N to M Relations

Creating Collections

Time-related Feature

Listing Collections

Adding Objects to Collections

Appending BOCollections to Collections

Merging BOCollections

Removing Objects from a Collection