Collection Properties

Visual LANSA

Collection Properties

Collections have a number of useful properties that can provide information about the collection items.

Sequential collections such as List and Array, provide the following:

First

The first item in the collection.

#Com_Owner.Caption := #Collection.First.ExampleProperty

 

This item could also be accessed as follows

#Com_Owner.Caption := #Collection<1>.ExampleProperty

 

Last

The last available instance in the collection

#Com_Owner.Caption := #Collection.Last.ExampleProperty

 

 

IndexOf

Returns the position of the supplied object in the collection

#Std_num := #Collection.IndexOf<#Object>

 

 

 

Ordered collections, such as Keyed and Dictionary collections, have no real concept of first and last. Instead a "Key" concept is used:

KeyOf

The value or object used to provide access to the collection item

For Each(#Item) In(#KeyedCollection)

#Empno := #KeyedCollection.Keyof<#Item>

 

Endfor

 

 

 

Collections provide a wide variety of methods and properties to allow you to easily manipulate the collection content. You are encouraged to investigate these methods and you will find details in the Visual LANSA Feature Help (F1 help) or Feature Help Guide.

Ý Access Collection Items