Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   msg object in JavaScript Writer? (http://www.mirthcorp.com/community/forums/showthread.php?t=13653)

jr76 03-25-2015 09:24 AM

msg object in JavaScript Writer?
 
Hi,

I'm trying to implement a JavaScript Writer. Most examples on the web seem to be for writing transformers, and there is a "msg" object available, from which you can do things like:

msg['MSH'][...]

How can I get access to this object (or something similar) in the JavaScript Writer context?

Thanks!

narupley 03-25-2015 09:27 AM

The msg/tmp variables are typically E4X XML objects that are created automatically in a transformer. That's what a transformer is supposed to be used for: transforming the message. So that begs the question: Why are you doing something in a JavaScript Writer that should be done in a transformer?

FYI you can manually declare msg in a JavaScript Writer, by using one of the conversion functions. Use the References list / User API / auto-completion menu, that's what they're there for.

Code:

var msg = new XML(SerializerFactory.getSerializer('HL7V2').toXML(connectorMessage.getEncodedData()));

jr76 03-25-2015 09:43 AM

Hi,

Thanks for your quick reply. Perhaps I'm going about this the wrong way. I'm using a JavaScript Writer because I wish to invoke a REST service and pass it some values extracted from the message. So I suppose my real question is, what is the appropriate way to extract values from a message in my JavaScript Writer code? I assumed that the "msg" object is what I'm looking for, because that's what I've seen around the web.

Thanks.

narupley 03-25-2015 09:45 AM

If you've never used Mirth Connect before, this is a good place to start: http://www.mirthcorp.com/webinars/mi...ect-screencast

Also the User Guide: http://info.mirth.com/Connect_Docume..._Download.html

soundhar 05-01-2017 12:19 PM

Hl7 to EXCEL
 
Guys,

I'm new in mirth interface need to Map Hl7 V2 message in Excel sheet.

I don't how to write transformer? Please give me some suggestion.

siddharth 05-03-2017 02:37 AM

Sounds like you also need to go through mirth 101 guide.
http://www.mirthcorp.com/community/w...rth/User+Guide


All times are GMT -8. The time now is 11:28 AM.

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