View raw Markdown
type: fhirpath-functionfunction: truncatecategory: Mathsection: 5.8.10source: fhirpath/functions.json

FHIRPath Function: truncate

{:.stu}

Returns the integer portion of the input. {:.stu}

Accepts input types of Decimal or Quantity. {:.stu}

When used with a Decimal input type, the result is an Integer.<br/> When used with a Quantity, the result is a Quantity with the same units and the value (Decimal) set to the integer result calculated. {:.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}

101.truncate() // 101
1.00000001.truncate() // 1
(-1.56).truncate() // -1

{:.stu}

Note: We may consider a TruncateLong() function to handle Long output types. {: .stu-note }

Summary

Description

Returns the integer portion of the input.

Arguments

Type Mapping

Example

101.truncate() // 101
1.00000001.truncate() // 1
(-1.56).truncate() // -1