About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 Register to post in forums, or Log in to your existing account
 

 Related 
Contents
Common Properties:
  Name *
Non-Visual Objects
  Action
  Collection
    Remove
    IndexOf
    Insert
    Find
    Item
    Delta
    Separator
    TextProp
    Add
    Base
    Value
    Text
    Count
    Clear
  Connection
  DataSource
  Head
  HTTP
  IniFile
  Message
  Query
  Queue
  Registry
  Store
  Stream
  Template
  Thread
  Var
  XML
  XSL
Related Links:
  Folder Interface
  FolderStore Interface
  Variant
  What zApp is NOT
  Grid
  Data
  Column
  Queue
  Find
  Separator
  TextProp
  Collection
  Store
  Folder
  Explode
  Join
  Match
  Split
  Params
  PostParams
  Text
  OnStartElement
  Errors
  GetElementsByTagName
  GetElementsByTagNameNS
  Attributes
  ChildNodes
  FindFiles
  Items
  Collection
  Items
  Items
  Items
  Selections
  Node
  Children
  Errors
  Collection
Collection [[zCollection]] 
NOTE: This Design document is subject to change at any time.
Collection

Syntax: <COLLECTION property-list/>

A Collection is a list of objects and is compatible with the standard COM Collection object. The objects in the collection can be of any type, and you can even mix different types within a single collection. An object can even be another collection to create multi-dimensional arrays.

Objects in the collection are retrieved by an index, which starts at 1 (the Base of the collection can be changed).

In addition to being a valid zApp component using the above tag, many zApp functions and routines use Collections. You can also create a collection using the core.CreateObject("Collection","") routine.

Collections are compatible with the "foreach" statement in scripting languages such as VBScript. Collections also implement associative arrays, or key=value lists, although for more robust key/value storage you can also use a zStore object instead of a Collection.

Collections maintain an internal update notification list and can notify other zApp components that use the collection when the collection is modified. For example, when a collection is added to a zGrid component, the grid is refreshed when a new item is added to the collection.

Examples:

Adding items to a collection:
Code:
Collection.Add( "Item1")
Collection.Add("Item2")
Collection.Item(1) = "New Item1"


Looping through a collection:
Code:
for i = 1 to Collection.Count
  S = Collection.Item(i)
next


Looping through a collection regardless of index values:
Code:
for each S in Collection
  msgbox S
next


Using a collection as an associative array:
Code:
Collection.Value("name") = "Zugg"
Collection.Value("mode") = 1
msgbox Collection.Value("name")
Viewer Comments [0 - Post your comments]

Jump to:  

© 2009 Zugg Software. Hosted by Wolfpaw.net