take_anyif
This page explains how to use the take_anyif aggregation function in APL.
take_anyif returns a value from an arbitrary row that matches a condition in each group.
Usage
Syntax
APL
Parameters
expr: The expression to return a value for.predicate: A Boolean expression that selects the rows to consider.GroupingColumn(optional): A column to group the results by. If you omit it, all records form one group.
Returns
Returns a value from a matching row in each group, skipping nulls and empty strings. If no rows match, or all matching values are null or empty strings, it returns null.
anyif is a deprecated alias of take_anyif.
Use case examples
One failing URI for each service
This example returns one URI with status 500 for each service. frontend has no matching request, so its result is null.
Query
APL
Output
| service | failed_uri | requests |
|---|---|---|
| checkout | /cart | 2 |
| frontend | 1 |
List of related aggregations
- take_any: Returns the values of one arbitrary row for each group, without a predicate.
- countif: Counts the records for which a predicate is true.
- make_set_if: Returns all distinct values of an expression for which a predicate is true.