OpenWGA 7.9 - TMLScript reference

WGA
Method :

toList(value1, value2, value3 ...)

On object WGA
Usage Converts any value into list form
Description

This method does the same list conversion known from itemList() or metaList() on a custom value. It is ensured that the return value is a non-null List with differing contents.

The method builds a list from the given input values. For each input value the following applies:

  • Given a list it adds all elements to the result list
  • Given other collections and arrays it adds all collection values to the result list
  • Given null it does not add anything to the list
  • All other values are added to the result list as element
Parameters

value (Object):

Any value to be converted to a list

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

WGA.toList() can be flexibly used to convert anything to a list. You can use it with a JavaScript array as parameter:

WGA.toList([1,2,3]) // List 1, 2, 3

You can also use it to construct a list by just giving all elements of it to the parameter list

WGA.toList("a", "b", "c") // List a, b, c

You can even use it to concatenate multiple collections:

var theList = WGA.toList("a", "b");

var theArray = ["c", "d"};

WGA.toList(theList, theArray) // List a, b, c, d