OpenWGA 7.5 - TMLScript reference

CollectionResult
Method :

filter(function)

On object CollectionResult
Usage Applies a filter to the collection result
Description

This creates a new CollectionResult which is based on the current CollectionResult but whose results are filtered by the given filter method.

The filter function is called for every document that is retrieved from the collection and receives it as a TMLContext parameter. It should return true if the document passes the filter and should be returned, false if it should not.

Parameters

function (Function):

A JavaScript function implementing the filter

Return value A filtered CollectionResult
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Examples

This code creates a children navigator, filters it for having only documents with contenttype "standard" and iterates over it:

var result = WGA.nav().children().filter(function(cx) cx.CONTENTTYPE=='standard');

for (cx in Iterator(result)) {

  ...

}