Working with Sort Queries

Sorting HL7 Messages

Sort queries let you sort a log on a message element (segment, field, component, or subcomponent).

Sorting data is useful when you want to group messages by criteria such as patient name, date, or location.


This sort on MSH 6 reorders messages by the name of the receiving facility, in this case a patient care location.

Select Message Data to Build Sort Queries

This is the recommended method for building sorts. Once you’ve built a query this way, you can also modify the Filter Operators to change your filter criteria.

  1. In the Messages area, look for the field containing the data you want to sort by. It could be a patient name, a date, a location, or another string.
  2. Right-click within the field. A menu appears.
  3. Click Add Sort.
  4. The sort query is automatically created within the Sort tab, and the reordered data is displayed within the Messages area.


Build Sort Queries Directly

This is an alternate method for building sort queries.

  1. In the Sorts tab, click the + Add button.
  2. Click on each of the Segment, Field, Component, and/or Subcomponent dropdown lists to select the element you’re sorting on. (Click image below to enlarge.)
  3. Apply the Order operator, selecting “ascending” or “descending” as needed.