web stats
Iterating through OBX Help - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-06-2013, 01:59 PM
atibbits atibbits is offline
Mirth Guru
 
Join Date: May 2012
Location: Salina, KS
Posts: 333
atibbits is on a distinguished road
Question Iterating through OBX Help

Hello! I am sure this is going to be an easy fix, but for the life of me I cannot get it to work right now. I am needing to iterate through every single OBX.5.1 and look for "Imaging Center". I would think that the below code would work, but for some reason it is not. Any suggestion would be appreciated:


Code:
for each (obx in msg.OBX)

 var obx5=['OBX.5']['OBX.5.1'].toString();

	if(obx5.indexOf("Imaging Center") > -1)
	{
	msg['MSH']['MSH.4']['MSH.4.1']= "IC";
    msg['MSH']['MSH.6']['MSH.6.1']= "IC";
}


Here is what I am looking for in the OBX:


Code:
OBX|35|TX|||   |
OBX|36|TX||| HISTORY:  Screening, history of benign left breast biopsy.  |
OBX|37|TX|||   |
OBX|38|TX||| LOCATION OF DICTATION:  Imaging Center  |
OBX|39|TX|||   |
OBX|40|TX||| COMPARISON:  06/05/2012 and 05/31/2011  |
OBX|41|TX|||   |
Reply With Quote
  #2  
Old 06-06-2013, 02:39 PM
eduardoa eduardoa is offline
Mirth Employee
 
Join Date: Mar 2013
Location: Santa Fe Springs, California
Posts: 86
eduardoa is on a distinguished road
Default

Looks like you missed the segment variable:
var obx5=['OBX.5']['OBX.5.1'].toString();
chanage to:
var obx5=obx['OBX.5']['OBX.5.1'].toString();

I also added a bracket I think you missed:

for each (obx in msg.OBX){

var obx5=obx['OBX.5']['OBX.5.1'].toString();
logger.info(obx5);
if(obx5.indexOf("Imaging Center") > -1)
{
logger.info("found");
msg['MSH']['MSH.4']['MSH.4.1']= "IC";
msg['MSH']['MSH.6']['MSH.6.1']= "IC";
}
}
Reply With Quote
  #3  
Old 06-07-2013, 06:54 AM
atibbits atibbits is offline
Mirth Guru
 
Join Date: May 2012
Location: Salina, KS
Posts: 333
atibbits is on a distinguished road
Default

Thank you so much!! I have never used the logger.info in Mirth, but it is working great now. Is it supposed to show all of the OBX data in the server log? It kind of makes sense that it would, but I am just making sure I am not breaking anything because I usually do not have much showing up there!
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 -7. The time now is 05:12 AM.


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