OpenWGA 7.8 - TMLScript reference

CollectionResult
Method :

map(function)

On object CollectionResult
Usage map(function) takes a JS-Function as parameter. This function is called for each result entry with the TMLContext as parameter and must return some value. The return value of map() is a list of all mapped values.
Description

The given function is called for every document that is retrieved from the collection and receives it as a TMLContext parameter.

Parameters

function (Function):

A JavaScript function

Return value The CollectionResult for further chaining.
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Examples
_opts = WGA.nav().children().map(function(doc){
  return doc.TITLE + "|" + doc.KEY
})