OpenWGA 7.0 - 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
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 Returns the first result document of the query
firstResultContent Returns the first result document of the query as WGAPI content object
fullQuery Returns the full query that was executed
getPage([offset,] length) inherited Returns a page of result documents
getSingleValue(itemName) Returns the value of an item from the first result document of this query
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 actual result set 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.