<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/cts.sumAggregate.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>cts.sumAggregate</api:function-name><api:suggest>cts.sumaggregate</api:suggest><api:suggest>cts</api:suggest><api:suggest>sumaggregate</api:suggest><api:function-link mode="xquery" fullname="cts:sum-aggregate">/apidoc/8.0/cts:sum-aggregate.xml</api:function-link><api:function mode="javascript" name="sumAggregate" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Math Lexicon" hidden="false" bucket="MarkLogic Built-In Functions" prefix="cts" namespace="http://marklogic.com/cts" fullname="cts.sumAggregate"><api:summary>
  Returns the sum of the values given a value lexicon.
  This function works like <code xmlns="http://www.w3.org/1999/xhtml">cts:sum</code> except it performs the
  calculation in parallel in all data nodes then aggregates the values.
  It generally performs better than <code xmlns="http://www.w3.org/1999/xhtml">cts:sum</code>, especially on
  large clusters.
</api:summary><api:params><api:param name="range-index" type="cts:reference"><api:param-description>
    Reference to a range index.
  </api:param-description><api:param-name>range-index</api:param-name><api:param-type>cts.reference</api:param-type></api:param><api:param name="options" type="xs:string*" optional="true"><api:param-description>
    Same as the "options" parameter in <code xmlns="http://www.w3.org/1999/xhtml">cts:aggregate</code>.
  </api:param-description><api:param-name>options</api:param-name><api:param-type>String[]</api:param-type></api:param><api:param name="query" type="cts:query?" optional="true"><api:param-description>
     Same as the "query" parameter in <code xmlns="http://www.w3.org/1999/xhtml">cts:aggregate</code>.
  </api:param-description><api:param-name>query</api:param-name><api:param-type>cts.query?</api:param-type></api:param><api:param name="forest-ids" type="xs:unsignedLong*" optional="true"><api:param-description>
     Same as the "forest-ids" parameter in <code xmlns="http://www.w3.org/1999/xhtml">cts:aggregate</code>.
  </api:param-description><api:param-name>forest-ids</api:param-name><api:param-type>String[]</api:param-type></api:param></api:params><api:return>xs.anyAtomicType?</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
//   This query assumes an element range index is configured
//   in the database for the 'Amount' element.

cts.sumAggregate(cts.elementReference(xs.QName("Amount")));

=&gt; 733.7600000000000128
</pre></api:example></api:function></api:function-page>