type: fhirpath-functionfunction: abscategory: Mathsection: 5.8.1source: fhirpath/functions.json
FHIRPath Function: abs
{:.stu}
Returns the absolute value of the input (in the same type). When taking the absolute value of a quantity, the unit is unchanged. {:.stu}
Accepts input types of Integer, Long, Decimal or Quantity. {:.stu}
If the input collection is empty, the result is empty. {:.stu}
If the input collection contains multiple items, the evaluation of the expression will end and signal an error to the calling environment. {:.stu}
(-5).abs() // 5
(-5.5).abs() // 5.5
(-5.5 'mg').abs() // 5.5 'mg'
Summary
- Category: Math
- Section:
5.8.1 - Return Type:
Integer | Long | Decimal | Quantity - Empty Input Result:
empty - Errors on Multiple Input:
true
Description
Returns the absolute value of the input. When taking the absolute value of a quantity, the unit is unchanged.
Arguments
Type Mapping
Example
(-5).abs() // 5
(-5.5).abs() // 5.5
(-5.5 'mg').abs() // 5.5 'mg'