| CCXML 1.0 Development Guide | Home | Frameset Home |
<foreach> element is a Voxeo extension to the CCXML 1.0 specification, (which is being proposed for inclusion to the spec), that allows the developer to iterate through a set of array values, (such as the session.connections[] array). This allows a simpler shorthand than using pure ECMAScript to loop through array values.
| cond | Data Type: (ECMAScript Expression) | Default: none - attribute is required |
| The cond attribute specifies an ECMAScript expression which can be evaluated to 'true' or 'false'. A condition must evaluate to 'true' in order for any enclosed operations to be performed. | ||
| item | Data Type: NMTOKEN | Default: Required |
The item attribute denotes the name of the variable that stores a particular array value as it is being iterated within the loop. If this variable is not already defined, then it will be declared upon invocation of the <foreach> element. | ||
| name | Data Type: (variable name) | Default: Required |
| The name attribute defines the name of the index that is to br refenced, (in this case, the connectionid). | ||
| object | Data Type: (ECMAScript Expression) | Default: Required |
The object attribute defines the name of the array or object to enumerate by the <foreach> element; failure to specify this attribute will result in an error.semantic event being thrown. | ||
| <?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0" xmlns="http://www.w3.org/2002/09/ccxml"> <eventprocessor> <transition event="connection.alerting" name="evt"> <accept/> <log expr="'*** CALL ACCEPTED ***'"/> </transition> <transition event="connection.connected" name="evt"> <!-- NOTE: CHECK THE LOGGER TO SEE THE ARRAY VALUES --> <foreach item="item" object="session.ioprocessors" name="name"> <log expr="'*** IO PROCESSOR ['+name+'] = ' + item + ' ***'"/> </foreach> <exit/> </transition> <transition event="error.*" name="evt"> <log expr="'ERROR OCCURRED: '+ evt.name"/> <exit/> </transition> </eventprocessor> </ccxml> |
| ANNOTATIONS: EXISTING POSTS |
| login |