OpenWGA 7.8 - WebTML reference

WebTML tags » foreach

<tml:foreach filter ="tmlscript-expression">


Specifies a TMLScript expression to filter values or documents that are iterated


Use the filter attribute if you are iterating over some documents or values but only want to execute the <tml:foreach> body contents for some of them. It takes a TMLScript expression that is executed against every single value that is iterated. The expression should evaluate to true for each value that the <tml:foreach> body content should be executed for and false otherwise.

On type="content" the expression will be run in the context of the content that is iterated. On all other types the variable "currentValue" will contain the value that is iterated, or alternatively you can specify a variable name to use for the iterated value by attribute currentvalue.

The advantage of this attribute over filtering manually with WebTML condition tags is that the <tml:foreach> tag will still put out the correct page size (if attribute pagesize is used) and the paging taginfos will remain valid for all values that pass the filter.


A <tml:foreach type="content"/> only displaying contents of content type "standard":

<tml:foreach type="content" filter="CONTENTTYPE == 'standard'">