$any
$any(array, function) -> boolean<af>Source: FUME
Availability
Community v3.2.0+
Enterprise v3.2.0+
Documentation
$any() returns true as soon as one result from the supplied function is truthy under JSONata boolean rules.
The supplied function receives the current value, index, and source collection. The function may do async work, and $any() evaluates items sequentially so it can stop at the first truthy result.
If the first argument is not already an array, FUME treats it as a one-item sequence. If the input is undefined, $any() treats it as an empty collection and returns false.
Use the explicit call form for the whole collection. The path operator is not a shortcut here: array.$any(...) would apply $any() per item before the function could see the full collection.
Examples
Detect whether any encounter is still in progress
Input
This example uses the encounters example input. The expression checks whether at least one encounter is still active.
Example input
[
{
"encounterId": "enc-1001",
"patientId": "pat-0001",
"status": "finished",
"class": "outpatient",
"type": "primary-care",
"reason": "routine follow-up",
"facility": "ExampleCare Clinic",
"practitionerId": "prac-4001",
"start": "2026-02-14T09:30:00Z",
"end": "2026-02-14T10:05:00Z"
},
{
"encounterId": "enc-1002",
"patientId": "pat-0001",
"status": "finished",
"class": "outpatient",
"type": "imaging",
"reason": "headache evaluation",
"facility": "ExampleCare Imaging",
"practitionerId": "prac-4002",
"start": "2026-03-01T15:10:00Z",
"end": "2026-03-01T15:45:00Z"
},
{
"encounterId": "enc-1003",
"patientId": "pat-0001",
"status": "in-progress",
"class": "virtual",
"type": "care-coordination",
"reason": "medication questions",
"facility": "ExampleCare Clinic",
"practitionerId": "prac-4003",
"start": "2026-03-10T11:20:00Z",
"end": ""
},
{
"encounterId": "enc-1004",
"patientId": "pat-0001",
"status": "planned",
"class": "outpatient",
"type": "lab",
"reason": "fasting labs",
"facility": "ExampleCare Clinic",
"practitionerId": "prac-4001",
"start": "2026-03-20T08:00:00Z",
"end": ""
}
]
Expression
$any($, function($e) { $e.status = "in-progress" })
Result
true