Siebel eScript Language Reference > Methods Reference > Array Methods >

Overview of Array Methods


Note the following:

  • An array is a class of object that holds multiple values instead of one value. To reference a single value in an array, you use an array index number or string that is associated with this value.
  • An array element is the value of an array object. It can include any data type. Siebel CRM does not require that the elements in an array be the same type, and it does not limit the number of elements that an array can include.
  • The index number is a number or a string that identifies the array element. This number follows the array name and you place it in square brackets.

The following example statements store values in an array:

var array = new Array;
array[0] = "fish";
array[1] = "fowl";
array["joe"] = new Rectangle(3,4);
array[foo] = "creeping things"
array[goo + 1] = "and so on."

Array elements can be noncontiguous. For example, an array can include the following items:

  • An element at index 0
  • No element at index 1
  • An element at index 2

An array typically starts at index 0. It does not typically start at index 1.

Example of Using an Array

An array can use a number as an index, so it allows you to work with sequential data. For example, to keep track of how many jelly beans you eat each day, you can graph your jelly bean consumption at the end of the month. An array provides a solution for storing such data. For example:

var April = new Array;
April[1] = 233;
April[2] = 344;
April[3] = 155;
April[4] = 32;

In this example, one variable contains all the data. You can write code that examines the value of April[x] to determine how many jelly beans you ate on day x. For example:

for(var x = 1; x < 32; x++)
TheApplication().Trace("On April " + x + " I ate " + April[x] +


   " jellybeans.\n");

Siebel eScript Language Reference Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.