Skip to content

bmel:count-if

Category: Array & Statistics · Returns: bmel:integer

Signature
bmel:count-if(array: bmel:array, cond: bmel:expression)

Description

Returns the count of elements in an array that satisfy the given boolean condition.

Arguments

Parameter Type Required Description
array bmel:array The array to evaluate.
cond bmel:expression Boolean predicate expression evaluated against each element.

Examples

LLM calls that hit the token limit
bmel:count-if({createChatCompletion:Response Payload[]}.$.choices.finish_reason, bmel:item == 'length')
Items with a price above 100
bmel:count-if({getOrder:Response Payload}.$.items.price, bmel:item > 100)

← Back to BMEL Reference