web stats
Transform ORU - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 01-05-2016, 03:29 AM
Mel Mel is offline
Mirth Newb
 
Join Date: Aug 2010
Posts: 15
Mel is on a distinguished road
Default Transform ORU

I'm running into an issue that seems would be an easy fix but can't seem to get working correctly.

I'm using v2.2.1 and accept an ORU message which then gets filtered on 1 of 3 destinations based on the value in PV1-39. I'm strictly filtering and not changing the data in any way except on the Peoria destination where I am swapping some components in PID-2 and PID-3. I can get the data to swap however it outputs all the other data that is in the Outbound Message Template instead of the data in the original message. Is there an easy way to output the original data and just swap PID-2 and PID-3? I've attached the channel here. Any help is appreciated!
Attached Files
File Type: xml TEST ORU.xml (27.9 KB, 13 views)
Reply With Quote
  #2  
Old 01-05-2016, 05:15 AM
jadams4's Avatar
jadams4 jadams4 is offline
OBX.3 Kenobi
 
Join Date: Aug 2015
Posts: 143
jadams4 is on a distinguished road
Default

don't use an outbound message template for that destination. that will allow the message to pass through as it was originally. Then use two transformer steps to reassign pid-2 and pid-3.
Reply With Quote
  #3  
Old 01-05-2016, 05:40 AM
Mel Mel is offline
Mirth Newb
 
Join Date: Aug 2010
Posts: 15
Mel is on a distinguished road
Default

When I remove the outbound message template I get an error "tmp" is not defined. Is there somewhere else that I would need to define "tmp"? Below is the error...



[2016-01-05 07:35:50,627] ERROR (org.mule.impl.DefaultComponentExceptionStrategy:9 5): Caught exception in Exception Strategy for: 3af65aa8-26b6-4603-929f-a7caa920df93: org.mule.umo.routing.RoutingException: Failed to route event via endpoint: null. Message payload is of type: com.mirth.connect.model.MessageObject
org.mule.umo.routing.RoutingException: Failed to route event via endpoint: null. Message payload is of type: com.mirth.connect.model.MessageObject
at org.mule.routing.outbound.OutboundMessageRouter.ro ute(OutboundMessageRouter.java:84)
at org.mule.impl.model.DefaultMuleProxy.onCall(Defaul tMuleProxy.java:247)
at org.mule.impl.model.seda.SedaComponent.doSend(Seda Component.java:209)
at org.mule.impl.model.AbstractComponent.sendEvent(Ab stractComponent.java:277)
at org.mule.impl.MuleSession.sendEvent(MuleSession.ja va:201)
at org.mule.routing.inbound.InboundMessageRouter.send (InboundMessageRouter.java:176)
at org.mule.routing.inbound.InboundMessageRouter.rout e(InboundMessageRouter.java:143)
at org.mule.providers.AbstractMessageReceiver$Default InternalMessageListener.onMessage(AbstractMessageR eceiver.java:487)
at org.mule.providers.AbstractMessageReceiver.routeMe ssage(AbstractMessageReceiver.java:266)
at org.mule.providers.AbstractMessageReceiver.routeMe ssage(AbstractMessageReceiver.java:225)
at com.mirth.connect.connectors.file.FileMessageRecei ver.processBatchMessage(FileMessageReceiver.java:1 65)
at com.mirth.connect.server.mule.adaptors.HL7v2Adapto r.processBatch(HL7v2Adaptor.java:109)
at com.mirth.connect.connectors.file.FileMessageRecei ver.processBatch(FileMessageReceiver.java:309)
at com.mirth.connect.connectors.file.FileMessageRecei ver.processFile(FileMessageReceiver.java:218)
at com.mirth.connect.connectors.file.FileMessageRecei ver.poll(FileMessageReceiver.java:118)
at org.mule.providers.PollingMessageReceiver.run(Poll ingMessageReceiver.java:97)
at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor.runWorker(ThreadPoolExecutor.java: 1061)
at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :575)
at java.lang.Thread.run(Unknown Source)Caused by: org.mule.umo.routing.CouldNotRouteOutboundMessageE xception: Failed to route event via endpoint: ImmutableMuleEndpoint{connector=com.mirth.connect. connectors.file.FileConnector@15dfb5f, endpointUri=file://C:/Mel/VBAN/ORU/Out/VBAN, transformer=Transformer{name='3af65aa8-26b6-4603-929f-a7caa920df93_destination_1_transformer', returnClass=false, returnClass=false, sourceTypes=[]}, name='_fileEndpoint#-1479665163', type='sender', properties={}, transactionConfig=org.mule.impl.MuleTransactionCon fig@dcbd52, filter=null, deleteUnacceptedMessages=false, initialised=true, securityFilter=null, synchronous=true, initialState=started, createConnector=0}. Message payload is of type: com.mirth.connect.model.MessageObject
at org.mule.routing.outbound.FilteringMulticastingRou ter.route(FilteringMulticastingRouter.java:72)
at org.mule.routing.outbound.OutboundMessageRouter$1. doInTransaction(OutboundMessageRouter.java:78)
at org.mule.transaction.TransactionTemplate.execute(T ransactionTemplate.java:48)
at org.mule.routing.outbound.OutboundMessageRouter.ro ute(OutboundMessageRouter.java:82)
... 19 moreCaused by: org.mule.umo.provider.DispatchException: Failed to route event via endpoint: ImmutableMuleEndpoint{connector=com.mirth.connect. connectors.file.FileConnector@4490c9, endpointUri=file://C:/Mel/VBAN/ORU/Out/Peoria, transformer=Transformer{name='3af65aa8-26b6-4603-929f-a7caa920df93_destination_3_transformer', returnClass=false, returnClass=false, sourceTypes=[]}, name='_fileEndpoint#-994514508', type='sender', properties={}, transactionConfig=org.mule.impl.MuleTransactionCon fig@1a9f7d1, filter=null, deleteUnacceptedMessages=false, initialised=true, securityFilter=null, synchronous=true, initialState=started, createConnector=0}. Message payload is of type: com.mirth.connect.model.MessageObject
at org.mule.providers.AbstractMessageDispatcher.send( AbstractMessageDispatcher.java:177)
at org.mule.impl.MuleSession.sendEvent(MuleSession.ja va:191)
at org.mule.impl.MuleSession.sendEvent(MuleSession.ja va:130)
at org.mule.routing.outbound.AbstractOutboundRouter.s end(AbstractOutboundRouter.java:85)
at org.mule.routing.outbound.FilteringMulticastingRou ter.route(FilteringMulticastingRouter.java:61)
... 22 moreCaused by: org.mule.umo.transformer.TransformerException: CHANNEL:
TEST ORUCONNECTOR:
PeoriaSCRIPT SOURCE:
SOURCE CODE:
14: function doTransform() { phase = 'transformer'; logger = Packages.org.apache.log4j.Logger.getLogger(phase); 15: 16: 17: var PID31 = msg['PID']['PID.3']['PID.3.1'].toString();18: 19: tmp['PID']['PID.2']['PID.2.1'] = PID31;20: var PID21 = msg['PID']['PID.2']['PID.2.1'].toString();21: var PID22 = msg['PID']['PID.2']['PID.2.2'].toString();22: var PID23 = msg['PID']['PID.2']['PID.2.3'].toString();23: var PID24 = msg['PID']['PID.2']['PID.2.4'].toString();LINE NUMBER:
19DETAILS:
ReferenceError: "tmp" is not defined. (com.mirth.connect.server.MirthJavascriptTransform erException) (org.mule.umo.transformer.TransformerException)
at com.mirth.connect.server.mule.transformers.JavaScr iptTransformer.transform(JavaScriptTransformer.jav a:316)
at org.mule.transformers.AbstractEventAwareTransforme r.doTransform(AbstractEventAwareTransformer.java:4 8)
at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:197)
at org.mule.impl.MuleEvent.getTransformedMessage(Mule Event.java:251)
at com.mirth.connect.server.controllers.DefaultMessag eObjectController.getMessageObjectFromEvent(Defaul tMessageObjectController.java:790)
at com.mirth.connect.connectors.file.FileMessageDispa tcher.doDispatch(FileMessageDispatcher.java:50)
at com.mirth.connect.connectors.file.FileMessageDispa tcher.doSend(FileMessageDispatcher.java:139)
at org.mule.providers.AbstractMessageDispatcher.send( AbstractMessageDispatcher.java:164)
... 26 moreCaused by: org.mule.umo.transformer.TransformerException: CHANNEL:
TEST ORUCONNECTOR:
PeoriaSCRIPT SOURCE:
SOURCE CODE:
14: function doTransform() { phase = 'transformer'; logger = Packages.org.apache.log4j.Logger.getLogger(phase); 15: 16: 17: var PID31 = msg['PID']['PID.3']['PID.3.1'].toString();18: 19: tmp['PID']['PID.2']['PID.2.1'] = PID31;20: var PID21 = msg['PID']['PID.2']['PID.2.1'].toString();21: var PID22 = msg['PID']['PID.2']['PID.2.2'].toString();22: var PID23 = msg['PID']['PID.2']['PID.2.3'].toString();23: var PID24 = msg['PID']['PID.2']['PID.2.4'].toString();LINE NUMBER:
19DETAILS:
ReferenceError: "tmp" is not defined. (com.mirth.connect.server.MirthJavascriptTransform erException)
at com.mirth.connect.server.mule.transformers.JavaScr iptTransformer.evaluateScript(JavaScriptTransforme r.java:410)
at com.mirth.connect.server.mule.transformers.JavaScr iptTransformer.transform(JavaScriptTransformer.jav a:296)
... 33 moreCaused by: com.mirth.connect.server.MirthJavascriptTransforme rException: CHANNEL:
TEST ORUCONNECTOR:
PeoriaSCRIPT SOURCE:
SOURCE CODE:
14: function doTransform() { phase = 'transformer'; logger = Packages.org.apache.log4j.Logger.getLogger(phase); 15: 16: 17: var PID31 = msg['PID']['PID.3']['PID.3.1'].toString();18: 19: tmp['PID']['PID.2']['PID.2.1'] = PID31;20: var PID21 = msg['PID']['PID.2']['PID.2.1'].toString();21: var PID22 = msg['PID']['PID.2']['PID.2.2'].toString();22: var PID23 = msg['PID']['PID.2']['PID.2.3'].toString();23: var PID24 = msg['PID']['PID.2']['PID.2.4'].toString();LINE NUMBER:
19DETAILS:
ReferenceError: "tmp" is not defined.
at com.mirth.connect.server.mule.transformers.JavaScr iptTransformer.evaluateScript(JavaScriptTransforme r.java:398)
... 34 more
Reply With Quote
  #4  
Old 01-05-2016, 05:51 AM
jadams4's Avatar
jadams4 jadams4 is offline
OBX.3 Kenobi
 
Join Date: Aug 2015
Posts: 143
jadams4 is on a distinguished road
Default

replace tmp with msg

tmp refers to the outbound template and msg refers to the current msg.
Reply With Quote
  #5  
Old 01-05-2016, 06:40 AM
sandersmr sandersmr is offline
OBX.2 Kenobi
 
Join Date: Feb 2013
Posts: 71
sandersmr is on a distinguished road
Default

You can either change your references to "tmp" to "msg", as jadams4 states, or set tmp=msg.

Really, though, tmp is only needed if you're changing the format away from what msg is, or you need to keep msg exactly as it is (maybe later references in that destination). Otherwise, you're probably better off just making your changes directly to msg.
Reply With Quote
  #6  
Old 01-05-2016, 06:52 AM
Mel Mel is offline
Mirth Newb
 
Join Date: Aug 2010
Posts: 15
Mel is on a distinguished road
Default

Thanks jadams4. That works perfectly!
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 05:15 AM.


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