After working with Joao Navarro in the WRC, here's what I discovered.
My initial query was based on the results of the "Show Query" button in the Management Portal Message Viewer. While that provided a good start, the SELECT clause that Navarro suggested returned what I was looking for.
A couple of notes:
- Dates are stored in UTC, so use "GETUTCDATE" when trying to limit the search parameters by time.
- RawContent contains carriage returns between the segments. You may need to remove $CHAR(13) with the appropriate function.
SELECT EnsLib_HL7.Message.RawContent AS Full_Message INTO :FullMessage
FROM Ens.MessageHeader head, EnsLib_HL7.SearchTable, EnsLib_HL7.Message
WHERE head.TimeCreated >= DATEADD(hour, -24, GETUTCDATE())
AND ((head.SourceConfigName = 'SITE ORM-ORU Inbound')
AND (head.TargetConfigName = 'SITE ORM 1 PreProcessor')
AND head.MessageBodyClassName=(('EnsLib.HL7.Message'))
AND head.MessageBodyId = EnsLib_HL7.SearchTable.DocId
AND EnsLib_HL7.SearchTable.PropId = 6
AND EnsLib_HL7.SearchTable.PropValue = :placerOrderNum
AND head.MessageBodyClassName='EnsLib.HL7.Message'
AND head.MessageBodyId=EnsLib_HL7.Message.%ID)
ORDER BY head.ID Desc
- Log in to post comments