Previous Topic

Book Contents

Book Index

Next Topic

Combatibility with JAVA Conventions

Some additional method aliases are provided in all of the containers and collections in order to ensure compatibility with adopted JAVA conventions and thus make it easier for experienced JAVA programmers to start writing scripts for Valuemation. These include

size()

An equivalent to the length metod. Returns the size of the container, in other words, the number of objects it holds.

get(int)

An equivalent to the item method, provided in order to ensure compatibility with accepted Java conventions. Returns object by its ID (order) number. The object will be returned in the same transaction as the container.

For more information about the length a item methods see Listing context of containers and Listing Collections.

Example - Number of objects in the container

We assume that you have run Valuemation and logged in correctly before starting this code. oVM variable now holds Application object. See Login Syntax for the section of the opening code.

‘creates the transaction

Set oTransaction = oVM.createTransaction

'gets Catalogs

Set oCatalog = oVM.getCatalogs.find(oTransaction,"Person")

‘the following line will add the requested information  to string, each item on a separate line

tmpString="Found Catalog: " & oCatalog.getName & vbNewLine & oCatalog.getCreatorId & vbNewLine & oCatalog.length()

'prints the list on screen

Wscript.echo tmpString

Comment: At the beginning, we get the Application object and create a transaction "oTransaction”. Then a catalog “Costs” is found. Next, a string “tmpString” is created and filled  with the name of the catalog, the ID of its creator and its length, all of which are outputs of the respective methods implemented in ApiCatalog. Finally, this string is printed on user’s screen.

See Also

Containers and Collections

Containers

Collections

Read Limit on Catalogues and Collections

Lists

Maps