type: fhirpath-operatoroperator: <category: Comparisonsection: 6.2.2source: fhirpath/operations.json
FHIRPath Operator: < (less-than)
The less than operator (<) returns true if the first operand is strictly less than the second. The operands must be of the same type, or convertible to the same type using implicit conversion.
10 < 5 // false
10 < 5.0 // false - note the 10 is converted to a decimal to perform the comparison
'abc' < 'ABC' // false
4 'm' < 4 'cm' // false (or { } if the implementation does not support unit conversion)
@2018-03-01 < @2018-01-01 // false
@2018-01-01 < @2018-01-01 // false - same precision
@2018-03 < @2018-03-01 // empty ({ }) - different precisions
@2018-03-01T10:30:00 < @2018-03-01T10:00:00 // false
@2018-03-01T10 < @2018-03-01T10:30 // empty ({ }) - different precisions
@2018-03-01T10:30:00 < @2018-03-01T10:30:00.0 // false - values are equal to seconds, trailing zeroes after the decimal are ignored
@2018-01-01T16:00:00+11:00 < @2018-01-01T15:00:00.0+10:00 // false (same moment in diff timezones)
@2018-01-01T16:00:00+12:00 < @2018-01-01T15:00:00.0+10:00 // true (4pm+12 is less than 5pm+10 when timezones are considered)
@T10:30:00 < @T10:00:00 // false
@T10 < @T10:30 // empty ({ }) - different precisions
@T10:30:00 < @T10:30:00.0 // false - values are equal to seconds, trailing zeroes after the decimal are ignored
Summary
- Category: Comparison
- Section:
6.2.2 - Left Argument:
String | Integer | Decimal | Quantity | Date | DateTime | Time - Right Argument:
String | Integer | Decimal | Quantity | Date | DateTime | Time - Return Type:
Boolean - Empty Input Result:
empty - Errors on Multiple Input:
true
Description
Returns true if the first operand is strictly less than the second. The operands must be of the same type, or convertible to the same type using implicit conversion. Both arguments must be collections with single values. String ordering is strictly lexical based on Unicode values.
Type Mapping
String-StringInteger-IntegerInteger-DecimalDecimal-IntegerDecimal-DecimalQuantity-QuantityDate-DateDateTime-DateTimeTime-Time