OpenWGA 7.5 - TMLScript reference


Object:

QueryResult

Description

Represents a CollectionResult carrying all resulting data of an executed query.

Besides the actual set which carries all the resulting documents this object can also be used to find out about other information of the query result, like the actually executed full query, whether the query was served from WGAPI query cache etc.

Retrieval Database.query()
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Inherits from object CollectionResult
Properties and methods
Name Purpose
each(function) inherited Applies a function to each element of the collection result.
exclude(context) inherited Filters out the given document from the collection result
executionTime Returns the time the query took to execute in milliseconds
filter(function) inherited Applies a filter to the collection result
firstResult inherited Returns the first result document of the collection
firstResultContent inherited Returns the first result document of the collection as WGAPI content object
fullQuery Returns the full query that was executed
getPage([offset,] length) inherited Returns a page of result documents
getSingleValue(itemName) inherited Returns the value of an item from the first result document of this collection
isEmpty() inherited Tests if the result has at last one elements, the current user can read.
originalResult inherited Returns the original QueryResult or NavigatorResult of this collection result
outputParams Returns all output parameters of the query
servedFromCache Returns if the query result was served from the WGAPI query cache
set Returns the WGAPI result set object of the query containing the resulting contents
size inherited Returns the number of result documents in the collection
skip(size) inherited Skips the first documents in the current collection result
Examples

Iterating over the results of a query result - variable "qs" - using an Iterator:

var qr = WGA.app().query("hql", "content.structentry.contenttype.name='standard'");

for (cx in Iterator(qr)) {

  list.add(cx.TITLE);

}

More examples on object CollectionResult.