OpenWGA 7.6 - 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) Applies a function to each element of the collection result.
exclude(context) Filters out the given document from the collection result
executionTime Returns the time the query took to execute in milliseconds
filter(function) Applies a filter to the collection result
firstResult Returns the first result document of the collection
firstResultContent Returns the first result document of the collection as WGAPI content object
fullQuery Returns the full query that was executed
getPage([offset,] length) Returns a page of result documents
getSingleValue(itemName) Returns the value of an item from the first result document of this collection
isEmpty() Tests if the result has at last one elements, the current user can read.
originalResult 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 Returns the number of result documents in the collection
skip(size) 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.