OpenWGA 7.11 - TMLScript reference
TMLContext "this"Method :
itemIterable(itemname)
On object | TMLContext "this" |
Usage |
Returns the value of an item or WebTML variable as an iterable |
Description |
This is a variant of this.item() which instead of single values will always return an iterable. If the contents of the item is not actually an iterable itself it will return an iterable with that contents being the only element. Iterables are all objects that can be used with JavaScript function "Iterator()" to iterate over their values in some loop. While Lists are iterables not all iterables need to have all their values already loaded like a List. They can load them in a "lazy" manner when they are.actually requested and also bypass this loading when they are not, avoiding effort. Iterables that do so are the CollectionResult and its descendants and also the ResultSet. Otherwise the behaviour of this method matches that of this.item(). |
Parameters |
itemname (String): Name of the field to retrieve |
Return value |
A JavaScript iterable containing the values of the item/varlable that was retrieved. An empty iterable if the item/variable was null or did not exist. |
Allowed in script types |
|
Examples |
Iterating over an iterable using this method with the Iterator() function. Each element will be given to the "elem" var inside the loop: for (var elem in Iterator(itemIterable("thatiterable"))) { log.info(elem); } |