web stats
OBX Code IF/Then question - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 10-30-2017, 05:48 AM
uncgman uncgman is offline
What's HL7?
Join Date: Oct 2017
Posts: 1
uncgman is on a distinguished road
Default OBX Code IF/Then question

Hello all,

New Mirth user here. We have Mirth Connect 3.3 and this is the first code I have had to work on so any help is really appreciated.

I am trying to change text in an OBX field when certain texts comes in another part of the OBX segment. I want OBX3.1 to be renamed to EPSTEINBARRIGG anytime we see 'EBV VIRAL CAPSID AG (VGA) AB (IGG) in OBX3.2.

Here is the code I am trying to use:

var obxSegments = seg['OBX'];
var obxNum=obxSegments.length();

i = 0;
for each (var obx in obxSegments){
if (seg['OBX'][i]['OBX.3']['OBX.3.2']=='EBV VIRAL CAPSID AG (VGA) AB (IGG)')

Reply With Quote
Old 10-31-2017, 07:58 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road

You're using a double equals (==) instead of a single equals (=) to assign OBX.3.1.

for each (obx in msg.OBX) {
	if (obx['OBX.3']['OBX.3.2'].toString() == 'EBV VIRAL CAPSID AG (VGA) AB (IGM)') {
		obx['OBX.3']['OBX.3.1'] = 'EPSTEINBARRIGM';
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

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 06:56 PM.

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