Sorting HL7 Messages
Sort queries 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 modify the Filter Operators to change your filter criteria.
- In the Messages area, look for the field containing the data on which you are sorting. It could be a patient name, a date, a location, or another string.
- Right-click within the field. A menu appears.
- Click Add Sort.
- 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.
- In the Sorts tab, click the + Add button.
- Click on each of the Segment, Field, Component, and/or Subcomponent dropdown lists to select the element on which you are sorting. (Click image below to enlarge.)
- Apply the Order operator, selecting “ascending” or “descending” as needed.
Add Sort Queries from the Message Definition Tree
You can also add sort queries from the Message Definition tree. To do so:
- Right-click any messages in the Messages area, then click “Message Definition…“.
- Navigate to the field you want to add.
- Right-click the field and select “Add Sort“.