web stats
count of segments - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 07-26-2010, 03:09 PM
deepa deepa is offline
OBX.1 Kenobi
 
Join Date: Feb 2010
Posts: 39
deepa is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 07-26-2010, 10:16 PM
StefanScholte StefanScholte is offline
 
Join Date: May 2009
Location: Netherlands, Harderwijk
Posts: 321
StefanScholte is on a distinguished road
Default

Hi Deepa,

try this

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

kind regards
Stefan Scholte
Reply With Quote
  #3  
Old 07-27-2010, 02:04 PM
deepa deepa is offline
OBX.1 Kenobi
 
Join Date: Feb 2010
Posts: 39
deepa is on a distinguished road
Default

yes that works. thank you!
Reply With Quote
  #4  
Old 08-12-2010, 05:46 AM
TMarz TMarz is offline
OBX.2 Kenobi
 
Join Date: Jul 2009
Posts: 60
TMarz is on a distinguished road
Default

Quote:
Originally Posted by StefanScholte View Post
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();
Reply With Quote
  #5  
Old 02-15-2013, 12:39 PM
mlucero2013 mlucero2013 is offline
What's HL7?
 
Join Date: Feb 2013
Posts: 4
mlucero2013 is on a distinguished road
Send a message via MSN to mlucero2013 Send a message via Skype™ to mlucero2013
Default 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
Reply With Quote
  #6  
Old 02-15-2013, 12:41 PM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,115
narupley is on a distinguished road
Default

Quote:
Originally Posted by mlucero2013 View Post
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.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #7  
Old 02-15-2013, 03:49 PM
mlucero2013 mlucero2013 is offline
What's HL7?
 
Join Date: Feb 2013
Posts: 4
mlucero2013 is on a distinguished road
Send a message via MSN to mlucero2013 Send a message via Skype™ to mlucero2013
Default HL7 message add to a unique counter

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
Attached Files
File Type: xml WorkList CTC.xml (27.7 KB, 14 views)
Reply With Quote
  #8  
Old 02-15-2013, 04:11 PM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,115
narupley is on a distinguished road
Default

Quote:
Originally Posted by mlucero2013 View Post
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')()
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #9  
Old 02-15-2013, 04:48 PM
mlucero2013 mlucero2013 is offline
What's HL7?
 
Join Date: Feb 2013
Posts: 4
mlucero2013 is on a distinguished road
Send a message via MSN to mlucero2013 Send a message via Skype™ to mlucero2013
Default Error count of segments

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
Attached Images
File Type: jpg 1.jpg (235.7 KB, 13 views)
File Type: jpg 3.jpg (281.8 KB, 13 views)
File Type: jpg 2.jpg (262.1 KB, 15 views)
Reply With Quote
  #10  
Old 02-16-2013, 10:29 AM
mlucero2013 mlucero2013 is offline
What's HL7?
 
Join Date: Feb 2013
Posts: 4
mlucero2013 is on a distinguished road
Send a message via MSN to mlucero2013 Send a message via Skype™ to mlucero2013
Default

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

Mark
Reply With Quote
Reply

Tags
count, segment

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:02 PM.


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