--- type: "fhirpath-function" title: "FHIRPath Function: take" function: "take" category: "Subsetting" section: "5.3.7" source: "fhirpath/functions.json" --- # FHIRPath Function: take Returns a collection containing the first `num` items in the input collection, or less if there are less than `num` items. If num is less than or equal to 0, or if the input collection is empty (`{ }`), `take` returns an empty collection. ## Summary - **Category**: Subsetting - **Section**: `5.3.7` - **Return Type**: `collection` - **Empty Input Result**: `empty` - **Errors on Multiple Input**: `false` ## Description Returns a collection containing the first `num` items in the input collection, or less if there are less than `num` items. If num is less than or equal to 0, `take` returns an empty collection. ## Arguments - `num`: `Integer` - Number of items to take ## Type Mapping - `Any-Any` ## Example ```fhirpath Patient.name.take(2) // takes the first 2 name elements ```