web stats
Converting xml data field in DB to HL7 message -- outbound - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 02-11-2015, 02:25 AM
mariya.mrudula mariya.mrudula is offline
What's HL7?
 
Join Date: Jan 2015
Posts: 2
mariya.mrudula is on a distinguished road
Post Converting xml data field in DB to HL7 message -- outbound

Hello Team,
I am a newbie to Mirth and JavaScript.
I am struggling to get the sample code. Please guide me as soon as possible.

I am using Mirth 3.1.1.7461 version and the scenario is that we are picking data from DB and we have to transform and send HL7 message to the destination.

I am able to convert few fields which have String data properly; however i am stuck in converting xml data field to HL7.

Here is the sample xml that is stored in GT1 field :-
<guarantorno />
<fname>Test First</fname>
<mname />
<lname>Name</lname>
<birthdate>10/04/1972</birthdate>
<sex>F</sex>
<homephone>(123)234-1234</homephone>
<workphone />
<address>12401 Test address</address>
<address2 />
<city>testcity</city>
<state>FL</state>
<zipcode>12345-7638</zipcode>
<type>Default Guarantor</type>
<relationship>03</relationship>
<ssn />
and in transformer i have written below code in which

var guarXML=msg['guarantorinfo'].toString();
if(guarXML !='undefined'){
for each ( guarantor in msg['guarantorinfo']){
logger.info("guarantor"+ guarXML);
// tmp['GT1'][0]['GT1.2']['GT1.2.1'] =guarXML.guarantor.guarantorno; --
I am getting Cannot read property "guarantorno" from undefined error
tmp['GT1'][0]['GT1.3']['GT1.3.2'] =msg['guarantor']['fname']; -- I am getting Cannot read property "fname" from undefined error


}

}
guarXML is picking up data correctly below is test sample that is picked up from guarXML
guarantor<guarantorno/><fname>Test first</fname><mname/><lname>Name</lname><birthdate>10/04/1972</birthdate><sex>F</sex><homephone>(123)234-1234</homephone><workphone/><address>12401 Test address</address><address2/><city>Testcity</city><state>FL</state><zipcode>12345-7638</zipcode><type>Default Guarantor</type><relationship>03</relationship><ssn/>
Reply With Quote
Reply

Tags
xml to hl7

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 03:49 PM.


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