web stats
Transformer help - Mirth Community

Go Back   Mirth Community > Mirth Connect > Development

Reply
 
Thread Tools Display Modes
  #1  
Old 09-09-2006, 01:11 AM
cableops cableops is offline
Mirth Newb
 
Join Date: Aug 2006
Posts: 21
cableops
Default Transformer help

Trying to learn the syntax for some simple transformers.

Can someone provide an example on how to move or copy PID:18 to PID:19.

Any help is appreciated.
Reply With Quote
  #2  
Old 09-13-2006, 11:45 AM
chrisl chrisl is offline
Mirth Employee
 
Join Date: Aug 2006
Posts: 967
chrisl is an unknown quantity at this point
Default Re: Transformer help

Are you creating a new HL7 message (outbound channel) or modifying an incoming HL7 message (inbound)?

A simple example would be this mapping in a new JAVASCRIPT transformer step:

(this is the syntax for an inbound channel):

msg['PID']['PID.19'] = msg['PID']['PID.18']['CX.1'];

The issue here is that PID.18 and PID.19 are different datatypes, so you must specify a specific field of PID.18 to copy (in this case I did CX.1). If you wanted all fields of PID.18 you could do:


msg['PID']['PID.19'] = msg['PID']['PID.18']['CX.1'] + msg['PID']['PID.18']['CX.4']['HD.1'] +msg['PID']['PID.18']['CX.5'] + msg['PID']['PID.18']['CX.6']['HD.1'];

To build this I:
1. created a new channel
2. went to edit the transformer
3. added a new step (changed the type to javascript)
4. pasted a sample hl7 message in the template
5. switched to the HL7 tree tab
6. expanded the message out to show the PID fields
7. dragged and dropped the fields to the javascript editor window.

__________________
Chris Lang
Reply With Quote
  #3  
Old 09-14-2006, 05:16 AM
cableops cableops is offline
Mirth Newb
 
Join Date: Aug 2006
Posts: 21
cableops
Default Re: Transformer help

Thanks for the help.

Your instructions have been most helpful. I can have the transformer apply to the XML output, but am having trouble applying it to an ER HL7 output.

Can you tell me what I'm missing?

I'm basically trying to modify an HL7 file in a .txt file and write it back to another folder also as a .txt

Reply With Quote
  #4  
Old 09-19-2006, 10:57 AM
chrisl chrisl is offline
Mirth Employee
 
Join Date: Aug 2006
Posts: 967
chrisl is an unknown quantity at this point
Default Re: Transformer help

The contents of the modified XML will update the ER7 automatically. Your file writer template should be: ${HL7 ER7}.

-Chris
__________________
Chris Lang
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 08:01 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation