Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   count of segments (http://www.mirthcorp.com/community/forums/showthread.php?t=4177)

deepa 07-26-2010 04:09 PM

count of segments
 
Hi,

I need the number of OBR segments in the HL7 message.

Is there an easy way to get a count of each type of segment, rather than use a for-loop as in -
for (obr in msg..OBR)


Thanks,
Deepa

StefanScholte 07-26-2010 11:16 PM

Hi Deepa,

try this

var OBRList = msg..OBR;
var numberOfOBR = OBRList.length();

kind regards
Stefan Scholte

deepa 07-27-2010 03:04 PM

yes that works. thank you!

TMarz 08-12-2010 06:46 AM

Quote:

Originally Posted by StefanScholte (Post 14536)
Hi Deepa,

try this

var OBRList = msg..OBR;
var numberOfOBR = OBRList.length();

kind regards
Stefan Scholte

If you wanted an even simpler way, may I suggest:

var numoOBR = msg['OBR'].length();

mlucero2013 02-15-2013 01:39 PM

Query
 
query, how do I apply that to the uid that shipping for any HL7 would happen some catch or guide me where that code entry.
thank you very much

narupley 02-15-2013 01:41 PM

Quote:

Originally Posted by mlucero2013 (Post 30825)
query, how do I apply that to the uid that shipping for any HL7 would happen some catch or guide me where that code entry.
thank you very much

Response, can you rephrase that? I'm not quite sure what you're asking.

mlucero2013 02-15-2013 04:49 PM

HL7 message add to a unique counter
 
1 Attachment(s)
sorry I do not speak your language, attached my channel, I would like to know how to apply the counter, is to add a counter only at the end of ZDS Segment Message.
currently gives me this:
OID.Year.Month.Day.Hour.Minute.Second.Milliseconds

I need send by HL7 this:
OID.Year.Month.Day.Hour.Minute.Second.Milliseconds . (Countunique)
as I apply???
thank you very much

narupley 02-15-2013 05:11 PM

Quote:

Originally Posted by mlucero2013 (Post 30827)
sorry I do not speak your language, attached my channel, I would like to know how to apply the counter, is to add a counter only at the end of ZDS Segment Message.
currently gives me this:
OID.Year.Month.Day.Hour.Minute.Second.Milliseconds

I need send by HL7 this:
OID.Year.Month.Day.Hour.Minute.Second.Milliseconds . (Countunique)
as I apply???
thank you very much

I'm still not quite sure what you're asking, but if you want to add a counter to the end of your Message Builder step's Mapping value that increments once for each message, you can do that by putting a variable in the global channel map in the deploy script:

Code:

$gc('count',new Number(0));
$gc('next',function(){$gc('count',new Number($gc('count')+1));return $gc('count')});

Then just append the following to the Mapping field in the Message Builder step:

Code:

+'.'+$gc('next')()

mlucero2013 02-15-2013 05:48 PM

Error count of segments
 
3 Attachment(s)
I pulled the following error:
Attached as did the capture agradeciar please if I would verify.

Error


2013-02-15 22:41:27,936] ERROR (com.mirth.connect.connectors.file.FileMessageRece iver:234): Unable to route.org.mule.umo.routing.RoutingException: Failed to transform message before applying the filter. Failed to route event via endpoint: ImmutableMuleEndpoint{connector=com.mirth.connect. connectors.file.FileConnector@3698889c, endpointUri=file:///home/Datatech/worklist/Prueba, transformer=Transformer{name='ByteArrayToString', returnClass=false, returnClass=false, sourceTypes=[class [B, class java.lang.String]}, name='_fileEndpoint#-1980304081', type='receiver', properties={}, transactionConfig=org.mule.impl.MuleTransactionCon fig@7486c091, filter=null, deleteUnacceptedMessages=false, initialised=true, securityFilter=null, synchronous=true, initialState=started, createConnector=0}. Message payload is of type: java.lang.String

at org.mule.routing.inbound.SelectiveConsumer.isMatch (SelectiveConsumer.java:64)

at org.mule.routing.inbound.InboundMessageRouter.rout e(InboundMessageRouter.java:79)

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.processFile(FileMessageReceiver.java:228)

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(Thread.java:662)
Caused by: org.mule.umo.transformer.TransformerException:
CHANNEL:
WorkList ITSOS PRUEBA
CONNECTOR:
sourceConnector
SCRIPT SOURCE:

SOURCE CODE:

19: tmp['OBR']['OBR.4']['OBR.4.2'] = validate(msg['row'][15]['column2'].toString(), '', new Array());
20: tmp['MSH']['MSH.10']['MSH.10.1'] = validate(messageObject.getId(), '', new Array());
21: tmp['ORC']['ORC.9']['ORC.9.1'] = validate(msg['row'][10]['column2'].toString()+msg['row'][11]['column2'].toString(), '', new Array());
22: tmp['OBR']['OBR.3']['OBR.3.1'] = validate(msg['row'][8]['column2'].toString(), '', new Array());
23: tmp['OBR']['OBR.12']['OBR.12.1'] = validate(msg['row'][4]['column2'].toString(), '', new Array());
24: tmp['ZDS']['ZDS.1']['ZDS.1.1'] = validate(tmp['ZDS']['ZDS.1']['ZDS.1.1']+msg['row'][7]['column2'].toString()+msg['row'][10]['column2'].toString()+msg['row'][11]['column2'].toString()+'.'+$gc('next')(), '', new Array());
25: tmp['PV1']['PV1.8']['PV1.8.2'] = validate(msg['row'][4]['column2'].toString(), '', new Array());
26: tmp['OBR']['OBR.24']['OBR.24.1'] = validate(msg['row'][3]['column2'].toString(), '', new Array());
27: tmp['PID']['PID.8']['PID.8.1'] = validate(msg['row'][14]['column2'].toString(), '', new Array());
28: tmp['OBR']['OBR.12']['OBR.12.1'] = validate(msg['row'][5]['column2'].toString(), '', new Array());
LINE NUMBER:
24
DETAILS:
TypeError: null is not a function, it is object. (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.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:200)

at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:200)

at org.mule.impl.MuleEvent.getTransformedMessage(Mule Event.java:251)

at org.mule.routing.inbound.SelectiveConsumer.isMatch (SelectiveConsumer.java:61)

... 11 more
Caused by: org.mule.umo.transformer.TransformerException:
CHANNEL:
WorkList ITSOS PRUEBA
CONNECTOR:
sourceConnector
SCRIPT SOURCE:

SOURCE CODE:

19: tmp['OBR']['OBR.4']['OBR.4.2'] = validate(msg['row'][15]['column2'].toString(), '', new Array());
20: tmp['MSH']['MSH.10']['MSH.10.1'] = validate(messageObject.getId(), '', new Array());
21: tmp['ORC']['ORC.9']['ORC.9.1'] = validate(msg['row'][10]['column2'].toString()+msg['row'][11]['column2'].toString(), '', new Array());
22: tmp['OBR']['OBR.3']['OBR.3.1'] = validate(msg['row'][8]['column2'].toString(), '', new Array());
23: tmp['OBR']['OBR.12']['OBR.12.1'] = validate(msg['row'][4]['column2'].toString(), '', new Array());
24: tmp['ZDS']['ZDS.1']['ZDS.1.1'] = validate(tmp['ZDS']['ZDS.1']['ZDS.1.1']+msg['row'][7]['column2'].toString()+msg['row'][10]['column2'].toString()+msg['row'][11]['column2'].toString()+'.'+$gc('next')(), '', new Array());
25: tmp['PV1']['PV1.8']['PV1.8.2'] = validate(msg['row'][4]['column2'].toString(), '', new Array());
26: tmp['OBR']['OBR.24']['OBR.24.1'] = validate(msg['row'][3]['column2'].toString(), '', new Array());
27: tmp['PID']['PID.8']['PID.8.1'] = validate(msg['row'][14]['column2'].toString(), '', new Array());
28: tmp['OBR']['OBR.12']['OBR.12.1'] = validate(msg['row'][5]['column2'].toString(), '', new Array());
LINE NUMBER:
24
DETAILS:
TypeError: null is not a function, it is object. (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)

... 17 more
Caused by: com.mirth.connect.server.MirthJavascriptTransforme rException:
CHANNEL:
WorkList ITSOS PRUEBA
CONNECTOR:
sourceConnector
SCRIPT SOURCE:

SOURCE CODE:

19: tmp['OBR']['OBR.4']['OBR.4.2'] = validate(msg['row'][15]['column2'].toString(), '', new Array());
20: tmp['MSH']['MSH.10']['MSH.10.1'] = validate(messageObject.getId(), '', new Array());
21: tmp['ORC']['ORC.9']['ORC.9.1'] = validate(msg['row'][10]['column2'].toString()+msg['row'][11]['column2'].toString(), '', new Array());
22: tmp['OBR']['OBR.3']['OBR.3.1'] = validate(msg['row'][8]['column2'].toString(), '', new Array());
23: tmp['OBR']['OBR.12']['OBR.12.1'] = validate(msg['row'][4]['column2'].toString(), '', new Array());
24: tmp['ZDS']['ZDS.1']['ZDS.1.1'] = validate(tmp['ZDS']['ZDS.1']['ZDS.1.1']+msg['row'][7]['column2'].toString()+msg['row'][10]['column2'].toString()+msg['row'][11]['column2'].toString()+'.'+$gc('next')(), '', new Array());
25: tmp['PV1']['PV1.8']['PV1.8.2'] = validate(msg['row'][4]['column2'].toString(), '', new Array());
26: tmp['OBR']['OBR.24']['OBR.24.1'] = validate(msg['row'][3]['column2'].toString(), '', new Array());
27: tmp['PID']['PID.8']['PID.8.1'] = validate(msg['row'][14]['column2'].toString(), '', new Array());
28: tmp['OBR']['OBR.12']['OBR.12.1'] = validate(msg['row'][5]['column2'].toString(), '', new Array());
LINE NUMBER:
24
DETAILS:
TypeError: null is not a function, it is object.

at com.mirth.connect.server.mule.transformers.JavaScr iptTransformer.evaluateScript(JavaScriptTransforme r.java:398)

... 18 more



Mi msn es marcoslucero@gmail.com

mlucero2013 02-16-2013 11:29 AM

good afternoon, yesterday you could see what errro postie?, thank you very much

Mark


All times are GMT -8. The time now is 04:43 AM.

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