Processes and outputs cScript between #LIST() and #ENDLIST for each item in a Publication List or collection.


#LIST($list, ...) ... #ENDLIST


  • list - One of the following:
    • Identifier of Publication List - Process a Publication List in the current cScript context and iterate through the results.
    • Variable contain a Collection - A variable containing a collection of objects, such as a field that contains a list, or a variable set with #CQL, #CPATH or #SQL.
    • Inline Query - A cPath or cQL query can be specified inside ${}.
  • ... - Optional parameters to pass to the Publication List, which will be available in the Publication List Filter and Order/Limit as $A, $B and so on.

Processing Iterations

The block of code between the #LIST() and #ENDLIST will be processed repeatedly, for each item in the list.

Iteration Object & Field Variables

Each item in the list is a cTemplate object where:

  • $this - The object of the current iteration can be accessed from the $this variable.
  • $field - All of the top-level fields of the object can be access directly from a variable named after their field identifier.

For example, the value of the Title field the object can be listed in either of the following ways:

  • ${this.Title}
  • $Title

Query SELECT clauses

The SELECT clause of the query a list is based on can affect field variables and their values and impact performance.

  • No SELECT - If no SELECT clause is specified in the list query, field values will be loaded on-demand when they are first accessed, which is less efficient than including the fields you will access in the SELECT clause to preload them.  For more information, see Populating the Object Cache.
  • SELECT deep dot-notation fields - In addition to the more obvious top-level fields, subfield values for objects referenced or embedded within the selected object can also be pre-loaded to improve performance.  Since the object structure is loaded, SELECTED deep dot-notation fields will be pre-loaded into the object structure, and not flattened into field variables at the top-level of the object, like a traditional SQL query or SELECT alias (see next bullet) would.
  • SELECT aliases - When a SELECT clause includes an "AS" alias, the value selected will be available in a variable named after the specified alias.  If the alias matches the name of a field, the alias value will override the field value and the field value will not be accessible.  For more information, see cQL SELECT Aliases.
For more information about how objects are loaded and cached from queries, see Repository Object Cache


Publication List

#/ List events from a Publication List with the Identifier "Events"
$Date - $Description


#/ List events in a Venue's Events list field
$Date - $Description


#/ List events in a Venue's Events list field
#CQL($Events,"FROM Event WHERE @(Events)Venue.OID=123")
$Date - $Description

Inline cPath Query Example

#/ List events in a Venue's Events list field
#LIST(${[:Venue AND OID=123].Events})
$Date - $Description

Inline cQL Query Example

#/ List events in a Venue's Events list field
#LIST(${FROM Event WHERE @(Events)Venue.OID=123})
$Date - $Description