Announcement

Collapse

Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

OBX NTE segment pairing

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

  • OBX NTE segment pairing

    I am trying to import HL7 transactions, and associate the NTE segments with
    the respective OBX segments, and the OBX segments with the respective OBR
    segments. (e.g. all the OBR, then all the OBX, then all
    the NTE) The problem is that ordering sequence is important (a given NTE is
    associated with the immediately preceding OBX, but does not have OBX
    identifier)
    Any pointers on how this can be done.
    Any suggestions would be greatly appreciated.
    Thanks.

  • #2
    Re:OBX NTE segment pairing

    Did you happen to figure this issue out? I'm faced with the same structure of HL7 multiple OBX's with NTE's for each.

    Comment


    • #3
      Re:OBX NTE segment pairing

      This is a pretty common issue. Rather than looping through all OBX's, you will need to loop through all segments and check if they are OBX or NTE. This way, you can save states and you will know which NTEs come after which OBX.

      I think the e4x way of looping through all segments would be something like msg.children(). If you get it all working, it might be helpful to others here if you contribute your code back to the forums.
      Jacob Brauer
      Director, Software Development
      NextGen Healthcare

      sigpic

      Comment


      • #4
        Re:OBX NTE segment pairing

        Hmmm, working on it now, will provide any feedback once I get it working.
        What about using the Strict Parser?

        Post edited by: rastababy, at: 07/02/2008 18:45

        Comment


        • #5
          Re:OBX NTE segment pairing

          I am working on the same problem! Have you got a solution for it yet?

          Comment


          • #6
            Possible Solution

            Hi,
            assuming you have a message similar to:
            ...
            OBR|70|1433519511|1433519511|La(LT)|||199902040800 00|||||||||||||||||||||
            OBX|70|NM|La(LT)|La(LT)|1.5|mmol/l||N|||F|||19990204080000|||||||||||||||
            OBR|71|1433519511|1433519511|Laktatkonstante|||199 90204080000|||||||||||||||||||||
            OBX|71|NM|Laktatkonstante|Laktatkonstante|1.35645| mmol/l||N|||F|||19990204080000|||||||||||||||
            OBR|72|1433519511|1433519511|Steigung|||1999020408 0000|||||||||||||||||||||
            OBX|72|NM|Steigung|Steigung|0|||N|||F|||1999020408 0000|||||||||||||||
            OBR|73|1433519511|1433519511|Link|||19990204080000 |||||||||||||||||||||
            OBX|73|ST|Link|Link|siehe unten|||N|||F|||19990204080000|||||||||||||||
            NTE|73||<a href=http://pat-serv/report/select.php?type=ergonizer\&piz=14335195\&labfid=14 33519511 target=_blank>Report</a>|
            OBR|74|1433519511|1433519511|Export|||199902040800 00|||||||||||||||||||||
            OBX|74|ST|Export|Export|siehe unten|||N|||F|||19990204080000|||||||||||||||
            NTE|74||<a href=http://pat-serv/report/export.php?piz=14335195\&labfid=1433519511 target=_blank>WinLactat Export</a>|

            The following code doen the Job:

            for each (seg in msg..OBX)
            {
            logger.error(seg['OBX.3']['OBX.3.1']+" = "+seg['OBX.5']['OBX.5.1']);

            for each (nte in msg..NTE)
            {
            if(seg['OBX.1']['OBX.1.1'].equals(nte['NTE.1']['NTE.1.1'])) logger.error(nte['NTE.3']['NTE.3.1']);
            }
            }

            So for each OBX, iterate over all NTEs (assuming there are only a few anyway) and finding the match by the Set ID seg['OBX.1']['OBX.1.1'].equals(nte['NTE.1']['NTE.1.1'])

            Comment


            • #7
              Hello,
              I have kind of the same problem and unable to find the right javascript code to handle it:

              Code:
              MSH|^~\&|ILABS|BBV|||20100805143021||ORU^R01||P|2.3
              PID|1|11566723|452200||TEST^BIODY^Monsieur||20.09.25|1
              ORC|RE||1008059000||CM||||20100805143021|||^Docteur TEST BIODYSSEE^||||||||
              OBR|1||1008059000||||20100805143021|||||||||^Docteur TEST BIODYSSEE^||||||F
              OBX|1|ST|1021_01^ERYTHROCYTES||5.00|T/l|4.40-6.00|N|||F|||||||||
              OBX|22|ST|252_01^HDL Cholestérol||3.0|mmol/l|>0,9|N|||F|||||||||
              NTE|1||test texte externe
              NTE|2||test2 texte externe2
              OBX|23|ST|2521_01^Rapport Chol/HDL||1.0|calcul|<5.0|N|||F|||||||||
              OBX|24|ST|2521_02^||Sans facteur de risque    < 6.5||||||F|||||||||
              I am able to extract the OBX segments and create records in my database with a source javascript transformer, but how can I extract the NTE segments and link them to the OBX that precedes (In my example, the NTE segments concern the HDL Cholestérol). For instance, I would like to merge the content of the NTE segments into one field named 'nte_segment' for each OBX in my database

              Here is the code of my transformer

              Code:
              var dbConn = DatabaseConnectionFactory.createDatabaseConnection('com.filemaker.jdbc.Driver','jdbc:filemaker://localhost/Mirth_Bridge','xxxx','yyyyy');
              for each (seg in msg..OBX) {
              	var lab_name = seg['OBX.3']['OBX.3.2'].toString();
              	var result = dbConn.executeUpdate(
              "INSERT IGNORE INTO Laboratoire_Incoming (labin_labobbvpatient_id, labin_analysis_name, nte_segment) VALUES " 
              + "('"+ $('PID_patientIdInternalId_id_No_Patient_BBV')+ "'" 
              + ",'" + lab_name + "')");
              }
              Thanks in advance for your help
              Last edited by dobunzli; 08-13-2010, 02:26 AM.

              Comment


              • #8
                In the case of an hl7 with only one OBR consisting of multiple OBX/NTE groups, I would associate NTEs with OBXs by creating a counter for the OBX.

                Run through the entire message segment by segment and try the following:
                - If segement = OBX,
                - - -save setid of OBX segment
                - - -increment counter
                - if segment = NTE and counter for OBX > 0 (make sure NTE is occuring after an OBX)
                - - -setid of this NTE = setid of OBX

                Then, each NTE segment is associated with the parent OBX segment.

                MSH|^~\&|ILABS|BBV|||20100805143021||ORU^R01||P|2. 3
                PID|1|11566723|452200||TEST^BIODY^Monsieur||20.09. 25|1
                ORC|RE||1008059000||CM||||20100805143021|||^Docteu r TEST BIODYSSEE^||||||||
                OBR|1||1008059000||||20100805143021|||||||||^Docte ur TEST BIODYSSEE^||||||F
                OBX|1|ST|1021_01^ERYTHROCYTES||5.00|T/l|4.40-6.00|N|||F|||||||||
                OBX|2|ST|252_01^HDL Cholestérol||3.0|mmol/l|>0,9|N|||F|||||||||
                NTE|2||test texte externe
                NTE|2||test2 texte externe2
                OBX|3|ST|2521_01^Rapport Chol/HDL||1.0|calcul|<5.0|N|||F|||||||||
                OBX|4|ST|2521_02^||Sans facteur de risque < 6.5||||||F|||||||||
                Last edited by bpatel; 08-13-2010, 10:04 AM.

                Comment


                • #9
                  Solution

                  Hey,

                  I struggled with this for months until yesterday.

                  Code:
                  //Where SEG is the repeating parent segment
                  function splitMessageOnSeg(SEG) {
                  var allow = false;
                  
                  // Get the current channel ID from the Message Object
                  var channelID = messageObject.getChannelId();
                  // Create an Instance of the controller
                  var channelController = Packages.com.webreach.mirth.server.controllers.ChannelController.getInstance();
                  //Perform Channel operations
                  channelID = channelController.getChannelName(channelID);
                  
                  //Check if there is more than 1 SEG
                  if(!msg[SEG][1])
                  {
                  	//if there is not, send message through
                  	allow = true;
                  
                  }else{
                  	//if there is more than 1 SEG, get the index of
                  	//the 2nd SEG.
                  	var SEG2index = msg[SEG][1].childIndex();
                  
                  	//make a copy of the message
                  	var temp = msg.copy();
                  
                  	//Delete your extra junk from original msg
                  	//i.e. Everything from the 2nd SEG down.
                  	while (msg.*[SEG2index] != undefined)
                  	{
                  		delete msg.*[SEG2index];
                  	}
                  
                  	//Remove the first SEG and its children from
                  	//the copied msg we now call "temp" so that we
                  	//can route it back to this channel sans its first
                  	//SEG family.
                  
                  	//First get the index of the 1st SEG
                  	var SEG1index = msg[SEG][0].childIndex();
                  
                  	//Next get the number of segments between the 1st and
                  	//2nd SEGs. This is how many to delete
                  	var diff = SEG2index - SEG1index;
                  
                  	for(var i = diff; i > 0; i--)
                  	{
                  		delete temp.*[SEG1index];
                  	}
                  
                  	//Send the now leaner message back to this channel			
                  	temp = SerializerFactory.getHL7Serializer(false, false, false).fromXML(temp);
                  	router.routeMessage(channelID,temp);
                  
                  	allow = true;
                  
                  }//end If Else
                  
                  return allow;
                  }
                  The code above is a code template that always returns true. It takes 1 argument which is the top level parent tag that repeats. So for example, if you had an ORM with multiple orders delimited by OBR's, you message could look something like:

                  PHP Code:
                  MSH|^~\&|CPSI_IF_FEED_OUT|CPSI Community Health System|||20100812084101||ORM^O01|20100812084101|P|2.3|||
                  PID|1||10002082|15894894|LILLY^MONK^||19540421||||^^^^||0000000000^^^^^0000000000|0000000000||||124039|000000000|||||||||||N
                  PV1
                  |1|2^O/P^02|^^|1|||787980^SPELLING^TIM^|000000^^^|000000^^^|01||||04||||||AA||||||||||||||||5||||||||201008111100|20100811110000||      139.00|||00021608
                  PV2
                  |1||||||C|20100811000000||||||||||||||||||20100811000000|G
                  GT1
                  |1||A^040105^0001||^^^^|0000000000^^^^^0000000000|0000000000|00000000||||000000000|||||^^^^|0000000000|||||||||||
                  ORC|NW|420232920100812|||IP||||201008120840|XXX||787980^SPELLING^TIM^|042|||
                  OBR|1|420232920100812||42440033^URINALYSIS TLR||201008120840|20100812084000|||XXX|O|||20100812084000|^^^|787980^SPELLING^TIM^||||||||LAB|P||001^^^20100811084000^^R|787980||||^^^|^^^|||||||||||81001
                  NTE
                  |1||
                  NTE|2||
                  NTE|3||
                  OBR|2|420232920100812||42440033^URINALYSIS TLR||201008120840|20100812084000|||XXX|O|||20100812084000|^^^|787980^SPELLING^TIM^||||||||LAB|P||001^^^20100811084000^^R|787980||||^^^|^^^|||||||||||81001
                  OBR
                  |3|420232920100812||42440033^URINALYSIS TLR||201008120840|20100812084000|||XXX|O|||20100812084000|^^^|787980^SPELLING^TIM^||||||||LAB|P||001^^^20100811084000^^R|787980||||^^^|^^^|||||||||||81001
                  NTE
                  |1||
                  DG1|1||
                  OBX|1||
                  OBR|4|420232920100812||42440033^URINALYSIS TLR||201008120840|20100812084000|||XXX|O|||20100812084000|^^^|787980^SPELLING^TIM^||||||||LAB|P||001^^^20100811084000^^R|787980||||^^^|^^^|||||||||||81001
                  NTE
                  |1||
                  NTE|2|| 
                  The number of repeating OBR's does not matter, and the types of children segments will only matter if they are used elsewhere in the message above the start of the OBR's(like if NTE's are used both for Order Entry Comments and Patient Notes).

                  All you need to do is import this code template and then use a javascript filter that looks something like this:

                  Code:
                  return splitMessageOnSeg('OBR');
                  The result will be that this function will split the message by the OBR's and send each one to the destination as its own ORM. It will work for any segment type with any number of children. I use it for DFT messages with multiple FT1's as well as ORM's with multiple orders. This way my transformers only have to be able to handle a single event per message.

                  Comment


                  • #10
                    Hello !
                    Thanks both of you for your replies.
                    TMarz your filter looks great and I am trying to implement it to my solution. Unfortunately I am getting this error

                    Code:
                    ERROR-300: Transformer error
                    ERROR MESSAGE:	Error evaluating transformer
                    com.mirth.connect.server.MirthJavascriptTransformerException: 
                    CHANNEL:	Dev_BBV To Filemaker
                    CONNECTOR:	sourceConnector
                    SCRIPT SOURCE:	
                    SOURCE CODE:	
                    11: var allow = false;
                    12: 
                    13: // Get the current channel ID from the Message Object
                    14: var channelID = messageObject.getChannelId();
                    15: // Create an Instance of the controller
                    16: var channelController = Packages.com.webreach.mirth.server.controllers.ChannelController.getInstance();
                    17: //Perform Channel operations
                    18: channelID = channelController.getChannelName(channelID);
                    19: 
                    20: //Check if there is more than 1 SEG
                    LINE NUMBER:	16
                    DETAILS:	TypeError: Cannot call property getInstance in object [JavaPackage com.webreach.mirth.server.controllers.ChannelController]. It is not a function, it is "object".
                    	at com.mirth.connect.server.mule.transformers.JavaScriptTransformer.evaluateScript(JavaScriptTransformer.java:450)
                    	at com.mirth.connect.server.mule.transformers.JavaScriptTransformer.transform(JavaScriptTransformer.java:347)
                    	at org.mule.transformers.AbstractEventAwareTransformer.doTransform(AbstractEventAwareTransformer.java:48)
                    	at org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:197)
                    	at org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:200)
                    	at org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:200)
                    	at org.mule.impl.MuleEvent.getTransformedMessage(MuleEvent.java:251)
                    	at org.mule.routing.inbound.SelectiveConsumer.isMatch(SelectiveConsumer.java:61)
                    	at org.mule.routing.inbound.InboundMessageRouter.route(InboundMessageRouter.java:79)
                    	at org.mule.providers.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:487)
                    	at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:266)
                    	at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:225)
                    	at com.mirth.connect.connectors.file.FileMessageReceiver.processFile(FileMessageReceiver.java:222)
                    	at com.mirth.connect.connectors.file.FileMessageReceiver.poll(FileMessageReceiver.java:115)
                    	at org.mule.providers.PollingMessageReceiver.run(PollingMessageReceiver.java:97)
                    	at org.mule.impl.work.WorkerContext.run(WorkerContext.java:290)
                    	at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
                    	at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
                    	at java.lang.Thread.run(Thread.java:637)
                    I have attached my channel export to this message. Maybe you can help me to debug ?
                    Attached Files

                    Comment


                    • #11
                      Hi.

                      There is another solution for this: check the "use strict parser" box in the incoming protocol. The strict parser creates the "standard" model, and in the standar model you'll get groups for each grouped segments (so will get all NTE paired with their OBX).

                      Of course the "strict parser" is a bit slower as it uses hapi to create the full model, but usually this time-degradation can't be appreciated.

                      Comment


                      • #12
                        Hello albertosaez and thanks for your tip. Looks like it is exactly what I was looking for. Now I have a nice structure in my Message Trees

                        Code:
                        MSH
                        ORU_R01_RESPONSE
                            --> ORU_R01_PATIENT
                            --> ORU_R01_ORDER_OBSERVATION
                                    --> ORC
                                    --> NTR
                                    --> NTE
                                    --> ORU_R01_OBSERVATION
                                             --> OBX
                                                      --> OBX.3
                                                              --> CE.2
                        
                                             --> NTE
                                                      --> NTE.3       
                        
                           --> ORU_R01_ORDER_OBSERVATION
                                    --> ORC
                                    --> NTR
                                    --> NTE
                                    --> ORU_R01_OBSERVATION
                                             --> OBX
                                                      --> OBX.3
                                                              --> CE.2
                        
                                             --> NTE
                                                      --> NTE.3   
                        
                           --> ORU_R01_ORDER_OBSERVATION
                                    --> ORC
                                    --> NTR
                                    --> NTE
                                    --> ORU_R01_OBSERVATION
                                             --> OBX
                                                      --> OBX.3
                                                              --> CE.2
                        
                                             --> NTE
                                                      --> NTE.3  
                        
                        ...
                        How can I get each 'OBX --> OBX.3 --> CE.2' ?
                        How can I get each 'NTE --> NTE.3' ?

                        And what if there are more than one 'NTE --> NTE.3' segment under one ORU_R01_OBSERVATION ?

                        Here is my actual javascript source transformer code

                        Code:
                        var dbConn = DatabaseConnectionFactory.createDatabaseConnection('com.filemaker.jdbc.Driver','jdbc:filemaker://localhost/Mirth_Bridge','xxx','yyy');
                        for each (seg in msg..ORU_R01.OBSERVATION) {
                        	var lab_name = seg['OBX.3']['CE.2'].toString();
                        	var result = dbConn.executeUpdate(
                        "INSERT IGNORE INTO Laboratoire_Incoming (labin_labobbvpatient_id, labin_labobbvdossier_id, labin_analysis_name) VALUES " 
                        + "('"+ $('patientIdInternalId_id')+ "'" 
                        + ",'" + $('fillerOrderNumber_entityIdentifier')+ "'"
                        + ",'" + lab_name + "')");
                        }

                        Comment


                        • #13
                          As the name of the XML fields has "." in their names, I would suggest another aproach:

                          Code:
                          var maxObs=msg['ORU_R01.PATIENT_RESULT']['ORU_R01.ORDER_OBSERVATION']['ORU_R01.OBSERVATION'].length();
                          
                          for( var obsi=0;obsi<maxObs;obsi++){
                                 var  observation =msg['ORU_R01.PATIENT_RESULT']['ORU_R01.ORDER_OBSERVATION']['ORU_R01.OBSERVATION'][obsi];
                          	var lab_name = observation['OBX']['OBX.3']['CE.2'].toString();
                                  var coments="":
                                  for each (nte in observation..NTE) {
                                        coments+=nte['NTE.3'].toString();
                                  }

                          Comment


                          • #14
                            There's more than one way to skin a cat...

                            Originally posted by dobunzli View Post
                            Hello !
                            Thanks both of you for your replies.
                            TMarz your filter looks great and I am trying to implement it to my solution. Unfortunately I am getting this error

                            Code:
                            ERROR-300: Transformer error
                            ERROR MESSAGE:	Error evaluating transformer
                            com.mirth.connect.server.MirthJavascriptTransformerException: 
                            CHANNEL:	Dev_BBV To Filemaker
                            CONNECTOR:	sourceConnector
                            SCRIPT SOURCE:	
                            SOURCE CODE:	
                            11: var allow = false;
                            12: 
                            13: // Get the current channel ID from the Message Object
                            14: var channelID = messageObject.getChannelId();
                            15: // Create an Instance of the controller
                            16: var channelController = Packages.com.webreach.mirth.server.controllers.ChannelController.getInstance();
                            17: //Perform Channel operations
                            18: channelID = channelController.getChannelName(channelID);
                            19: 
                            20: //Check if there is more than 1 SEG
                            LINE NUMBER:	16
                            DETAILS:	TypeError: Cannot call property getInstance in object [JavaPackage com.webreach.mirth.server.controllers.ChannelController]. It is not a function, it is "object".
                            	at com.mirth.connect.server.mule.transformers.JavaScriptTransformer.evaluateScript(JavaScriptTransformer.java:450)
                            	at com.mirth.connect.server.mule.transformers.JavaScriptTransformer.transform(JavaScriptTransformer.java:347)
                            	at org.mule.transformers.AbstractEventAwareTransformer.doTransform(AbstractEventAwareTransformer.java:48)
                            	at org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:197)
                            	at org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:200)
                            	at org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:200)
                            	at org.mule.impl.MuleEvent.getTransformedMessage(MuleEvent.java:251)
                            	at org.mule.routing.inbound.SelectiveConsumer.isMatch(SelectiveConsumer.java:61)
                            	at org.mule.routing.inbound.InboundMessageRouter.route(InboundMessageRouter.java:79)
                            	at org.mule.providers.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:487)
                            	at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:266)
                            	at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:225)
                            	at com.mirth.connect.connectors.file.FileMessageReceiver.processFile(FileMessageReceiver.java:222)
                            	at com.mirth.connect.connectors.file.FileMessageReceiver.poll(FileMessageReceiver.java:115)
                            	at org.mule.providers.PollingMessageReceiver.run(PollingMessageReceiver.java:97)
                            	at org.mule.impl.work.WorkerContext.run(WorkerContext.java:290)
                            	at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
                            	at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
                            	at java.lang.Thread.run(Thread.java:637)
                            I have attached my channel export to this message. Maybe you can help me to debug ?


                            Wow, that sucks. Problem is, that part is not really my code. I got it from this forum and then looked through the source code for some of the available public methods I could call. While I know it doesn't help to hear this, I can tell you that those calls work for me on the 100 or so Mirth boxes I support. It might have something to do with your version of Java or your version of Mirth. I couldn't say.

                            But what I can help you with is adapting this code. The good news is that those lines are not essential to your issue. They were only there for it to be implemented in the general case as a code template. If we remove that component it might get you up and running. Let's forget the code template for now.

                            The code below can just be copied directly into the javascript filter. You will notice the 2 variable definitions at the top. The first is the name of the channel. This is the same channel you have this filter on. Remember this code is designed to route back to itself; pseudo-recursively. The second variable is, again, just the name of the repeating parent segment.

                            Code:
                            var channelID = "[COLOR="DeepSkyBlue"]The name of this channel goes here[/COLOR]";
                            
                            var SEG = "[COLOR="DeepSkyBlue"]Segment goes here[/COLOR]";
                            
                            var allow = false;
                            
                            
                            
                            //Check if there is more than 1 SEG
                            if(!msg[SEG][1])
                            {
                            	//if there is not, send message through
                            	allow = true;
                            
                            }else{
                            	//if there is more than 1 SEG, get the index of
                            	//the 2nd SEG.
                            	var SEG2index = msg[SEG][1].childIndex();
                            
                            	//make a copy of the message
                            	var temp = msg.copy();
                            
                            	//Delete your extra junk from original msg
                            	//i.e. Everything from the 2nd SEG down.
                            	while (msg.*[SEG2index] != undefined)
                            	{
                            		delete msg.*[SEG2index];
                            	}
                            
                            	//Remove the first SEG and its children from
                            	//the copied msg we now call "temp" so that we
                            	//can route it back to this channel sans its first
                            	//SEG family.
                            
                            	//First get the index of the 1st SEG
                            	var SEG1index = msg[SEG][0].childIndex();
                            
                            	//Next get the number of segments between the 1st and
                            	//2nd SEGs. This is how many to delete
                            	var diff = SEG2index - SEG1index;
                            
                            	for(var i = diff; i > 0; i--)
                            	{
                            		delete temp.*[SEG1index];
                            	}
                            
                            	//Send the now leaner message back to this channel			
                            	temp = SerializerFactory.getHL7Serializer(false, false, false).fromXML(temp);
                            	router.routeMessage(channelID,temp);
                            
                            	allow = true;
                            
                            }//end If Else
                            
                            return allow;
                            If you get this to work and you still are really serious about using a code template you would just need to expand the code above and take an additional parameter for the channel name since those lines which automate that part seem to be causing you trouble.

                            Let me know how it works out.
                            Last edited by TMarz; 08-16-2010, 06:05 AM.

                            Comment


                            • #15
                              Hello !

                              THANK YOU BOTH OF YOU !


                              Both methods you suggested are actually working well.

                              albertosaez: everything is perfect ! Great !

                              TMarz: with your method there is still one little problem, the content of the NTE segment is extracted correctly but with tags.

                              Exemple:

                              "<NTE.3><NTE.3.1>test1</NTE.3.1></NTE.3><NTE.3><NTE.3.1>test2</NTE.3.1></NTE.3>" instead of just "test 1 test 2"

                              Anyway thanks again both of you for your time and solution.

                              Comment

                              Working...
                              X