NumberOfResults¶
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 parameter —
NumberOfResults()returnscontextCache.currentResults, the number of forks active in the current execution path. Useful for diagnostic side-channels and as a top-level row counter. - Field parameter —
NumberOfResults(: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 anARRAY,NumberOfResultsreturns 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¶
- 1 —
fieldOptional — 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)
Sibling-field result count
New-mode ARRAY-aware count
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.