OpenWGA 7.6 - OpenWGA Concepts and Features

Design and development » TMLScript » Items, metadata and variables in TMLScript

Retrieving multivalue items and variables

There is a special behavour with retrieving items, metadatas and WebTML variables set by WebTML functionalities (like attribute var) if they contain multiple values.  In that case this.item() and this.meta() will only return the first value. This also applies to the short forms of these methods discussed before. The reason for this is that WebTML tags and items on some content platforms (Lotus Domino) always store values in the form of multivalue lists, so OpenWGA itself cannot determine if it should return a list or not.

If you need to retrieve all values of these fields you need to use this.itemList() and this.metaList() instead. These methods always return lists, even if the retrieved field has only one value (which then is the only value in the list). Even if a field is empty or not defined it will return an empty list.

This special behaviour does not apply to WebTML variables set by TMLScript. When storing a List into a WebTML variable here then it will also be retrieved as List by this.item(), so the behaviour is straight-forward here.