Siebel eScript Language Reference > Siebel eScript Commands >
An array is a special class of object that holds several values rather than one. You refer to a single value in an array by using an index number or string assigned to that value.
The values contained within an array object are called elements of the array. The index number used to identify an element follows its array name in brackets. Array indices must be either numbers or strings.
Array elements can be of any data type. The elements in an array do not need to be of the same type, and there is no limit to the number of elements an array may have.
The following statements demonstrate how to assign values to an array:
var array = new Array;
array = "fish";
array = "fowl";
array["joe"] = new Rectangle(3,4);
array[foo] = "creeping things"
array[goo + 1] = "and so on."
The variables foo and goo must be either numbers or strings.
Because arrays use a number to identify the data they contain, they provide an easy way to work with sequential data. For example, to keep track of how many jellybeans you ate each day, you could graph your jellybean consumption at the end of the month. Arrays provide an ideal solution for storing such data.
var April = new Array;
April = 233;
April = 344;
April = 155;
April = 32;
Now you have your data stored in one variable. You can find out how many jellybeans you ate on day x by checking the value of April[x]:
for(var x = 1; x < 32; x++)
TheApplication().Trace("On April " + x + " I ate " + April[x] +
Arrays usually start at index , not index .
NOTE: Arrays do not have to be continuous. You can have an array with elements at indices 0 and 2 but none at 1.
The Array Constructor in Siebel eScript