web stats
Question about inserting multiple messages between others - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 05-11-2012, 06:13 AM
RobertD RobertD is offline
OBX.2 Kenobi
 
Join Date: Apr 2012
Posts: 89
RobertD is on a distinguished road
Default Question about inserting multiple messages between others

Hi again:

I have a situation where I have to insert *two* OBX messages between the preceeding OBR and first actual OBX message. The message segments were already built before-hand.

Does anyone have a quick little example of this? I did do a search first for 'inserting messages' but nothing relevant showed up.

Thanks,
Robert
Reply With Quote
  #2  
Old 05-11-2012, 06:24 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

Assuming that you only have one OBR in the message, you could do:

Code:
msg.OBR += obx1 + obx2;
Reply With Quote
  #3  
Old 05-11-2012, 06:31 AM
RobertD RobertD is offline
OBX.2 Kenobi
 
Join Date: Apr 2012
Posts: 89
RobertD is on a distinguished road
Default

Yes, there is only one OBR - thank you so much! That worked

Robert
Reply With Quote
  #4  
Old 05-11-2012, 06:39 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

No prob! Also FYI, if you do have more than one OBR, you can insert nodes after a specific one as well. For example, to insert after the second OBR:

Code:
msg.OBR[1] += obx1 + obx2;
Just be sure to put some validation in there because if there are less than two OBRs in the message, that code will throw an error. Perhaps a better way to do it is to iterate through each OBR in the message:

Code:
for each (obr in msg.OBR)
	msg.children()[obr.childIndex()] += obx1 + obx2;
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 07:03 AM.


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