Skip to content

NumberOfResults

aggregating category: cdm-helpers no `||` resultSize: 1

Returns the number of results produced by a sibling field, or by the current execution context.

NumberOfResults reports a row-level fan-out count as an INT. It has two forms:

  • No parameterNumberOfResults() returns contextCache.currentResults, the number of forks active in the current execution path. Useful for diagnostic side-channels and as a top-level row counter.
  • Field parameterNumberOfResults(:other_field) counts how many results the named sibling field produced. The other field must be in the same CDM table. In new mode, when the sibling holds an ARRAY, NumberOfResults returns the array's length directly.

For new-mode ARRAY-valued fields you can use the equivalent Size() rule, which reads the array length from a pipeline value rather than through a sibling-field dependency.

Parameters

1field Optional — accepts: field

A sibling field reference. When omitted, the rule returns the number of results in the current execution context.

Input type

Output type

  • INT

Requires

  • When given, the field reference must point to a field in the same CDM table.

Examples

Per-row count (test056)

NumberOfResults() => :result_count

Sibling-field result count

NumberOfResults(:year_of_birth) => :yb

New-mode ARRAY-aware count

NumberOfResults(:month_of_birth) => :mb

Errors

  • NumberOfResults requires a reference to a field in the same CDM table as the one the rule is executed from.
    The parameter is not a valid sibling-field reference.
  • NumberOfResults accepts either no parameters or a single field reference parameter
    Wrong arity.
  • `NumberOfResults' does not support multi-sized results
    The rule was used with a [] or [N] suffix.

See also

Size, GetCDMFieldValue, AutoGenId