Value structures (collections)
Collections are list-like objects that form a "container" for other objects. Unlike lists, however, the order is not important and the objects contained are stored under a name (in so-called fields) in the container. The type of collections is only determined by the composition, so collection types do not have their own names.
A special feature of collections is that they are characterized by a main object to which the context menu in table views refers. In the MM-Talk function wizard, access elements are displayed for all contained fields if the source object is a collection. For collections, there are only functions for setting them up and accessing their fields.
Collection.Add
[Fieldname:String;Value:Object]→Collection
Result: The Add
function returns a collection that has been extended by a new field. If the old collection already contained a field with the name <field name>, its old value is replaced by the new one. The main object has the field name " " or _.
Beispiel
MakeCollection.Add
["Weight";13]
Collection.GetKeyList→List
(String)
Result: The GetKeyList
function returns a list with the keys of the collection values.
Object.MakeCollection→Collection
Result: The MakeCollection
function returns a collection whose main object is the passed object and which otherwise contains no fields.
Collection.Value
[Name;Default]→Object
Result: The Value
function returns the value of the field in the collection. The optional parameter <Default> can be used to set a default value to be used if necessary.
Beispiel
$Collection.Value
returns the main object of the collection.