The maptree and maprange functions copy messages between identical structures.
Useful for cases when you are not transforming a message, only implementing minimal changes.
same inbound/outbound message type and structure
mapTree and mapRange
When you want to copy over whole messages or segments between HL7 messages, mapTree and mapRange will do it most efficiently.
OutboundMessage.MSH:mapTree(InboundMessage.MSH)
This maps the whole MSH segment.
OutboundMessage:mapRange(InboundMessage,1,7)
This maps over the first seven segments.
You can use this under two conditions:
You are mapping between HL7 node trees.
You are mapping between similar message structures (messages or segments share the same definition). That means identical fields and identical order.
Mapping HL7 to HL7: http://help.interfaceware.com/kb/mapping-hl7-hl7