Announcement

Collapse
No announcement yet.

count of segments

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    Hi Deepa,

    try this

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

    kind regards
    Stefan Scholte
    Stefan

    Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

    Comment


    • #3
      yes that works. thank you!

      Comment


      • #4
        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();

        Comment


        • #5
          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

          Comment


          • #6
            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.

            Comment


            • #7
              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

              Comment


              • #8
                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.

                Comment


                • #9
                  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. [email protected], 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 [email protected], 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 [email protected]
                  Attached Files

                  Comment


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

                    Mark

                    Comment

                    Working...
                    X