OpenWGA 7.10 - TMLScript reference

WGA » WGA.List()
Method :

filter(function)

On object WGA.List()
Usage

Calls the function with each list element and returns the filtered list as WGAList object for further method chaining.

Parameters

function

a JavaScript function to be called for each element.

The function is called with th current list element as parameter. If the return value is false, the value is not put into the resulting list.

Return value

WGAList object with filtered values.

Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Examples
WGA.List([0,1,2,3]).filter(function(v){
    return v > 0;
})
// returns [1,2,3]