Collections |
Top Previous Next |
What is a collection?
A collection is a type of object. They are used to group similar items together. Collections are similar to lists in EMUE in that they have rows, but different in that they can hold more complex data than a list. They can only be used if you have a web services connector.
How do I create and use a collection?
Collections will be defined in an XML definition file. Using the CreateObject command users can create an object. This example creates a object, RecordObject, that is of type Record in the EZText.XML object definition file. Record is defined as a collection. All collections have built in methods, Add and Clear.
We can add items to the collection by using the Add method.
CreateObject RecordObject "C:\Temp\EZText.xml" Record
RecordObject.Add("777-777-7777") RecordObject.Add("888-888-8888") RecordObject.Add("999-999-9999")
Collections have a built in property, Count, that provides the number of items currently in the collection.
Copy TotalRecords RecordObject.Count
Now that we have created a collection, we can pass that collection in as a parameter to the GetObjectData or ExecuteObjectMethod command.
GetObjectData Results Text.SendText(RecordObject,"Stream has started!")
The Clear method will delete all entries in the collection.
RecordObject.Clear
Iterating through a collection
The most basic way to loop through and process a collection is by using a Structured For loop. This code loops through all rows in the RecordObject collection and writes each phone number and text result to the log file.
For i = 1 to RecordObject.Count Logline RecordObject[i].PhoneNumber ", " RecordObject[i].Result Next i
See Also: |