Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference > Siebel eScript Language Overview > eScript Statements >
for...in Statement
The for...in statement loops through the properties of an object.
Syntax
for (propertyVar in object)
{
statement_block;
}
Placeholder Description object An object previously defined in the script propertyVar A variable that iterates over every property of the objectReturns
Not applicable
Usage
NOTE: An object must have at least one defined property or it cannot be used in a for...in statement.
When using the for ... in statement in this way, the statement block executes one time for every property of the object. For each iteration of the loop, the variable propertyVar contains the name of one of the properties of object and may be accessed with a statement of the form
object
[
propertyVar
]
.NOTE: Properties that have been marked with the DONT_ENUM attribute are not accessible to a for...in statement.
Example
This example creates an object called
obj
, and then uses the for...in statement to read the object's properties. The result appears in the accompanying illustration.function PropBtn_Click ()
{
var obj = new Object;
var propName;
var msgtext = "";obj.number = 32767;
obj.string = "Welcome to my world.";
obj.date = "April 25, 1945";for (propName in obj)
{
msgtext = msgtext + "The value of obj." + propName +
" is " + obj[propName] + ".\n";
}
TheApplication().RaiseErrorText(msgtext);
}
Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference Published: 18 April 2003 |