$all
$all(array, function) -> boolean<af>Source: FUME
Availability
Community v3.2.0+
Enterprise v3.2.0+
Documentation
$all() returns true only when every 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 $all() evaluates items sequentially so it can stop at the first falsy result.
If the first argument is not already an array, FUME treats it as a one-item sequence. If the input is undefined, $all() treats it as an empty collection and returns true.
Use the explicit call form for the whole collection. The path operator is not a shortcut here: array.$all(...) would apply $all() per item before the function could see the full collection.
Examples
Confirm every encounter belongs to the same patient
Input
This example uses the encounters example input. The expression checks that the whole batch belongs to a single patient.
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
$all($, function($e) { $e.patientId = "pat-0001" })
Result
true