web stats
Filter message on segment content - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 11-23-2011, 07:53 AM
ehobbs ehobbs is offline
Mirth Newb
 
Join Date: Jul 2011
Posts: 7
ehobbs is on a distinguished road
Default Filter message on segment content

Hi all,

This should be a no-brainer but for some reason I'm not getting it. I want to delete any message with a trigger in MSH.9.2 of A08 that also has a date in PV1.45.1. This is the code;

if (msg['MSH']['MSH.9']['MSH.9.2'] = "A08" && msg['PV1']['PV1.45']['PV1.45.1'] != "" )
{
delete msg;
}

This seems to delete every message. What am I missing.

Ed
Reply With Quote
  #2  
Old 11-23-2011, 10:43 AM
Bostad Bostad is offline
Level 85 Channel Wizard
 
Join Date: Mar 2009
Location: Stratford Ontario
Posts: 712
Bostad is an unknown quantity at this point
Default

A couple of things you need to change the first operator to '=='

Adding .toString() may help too.

You could add this to filter and just have {return false} else {return true}

It would make it a bit neater.
__________________
I can be reached through gmail and Google Talk using davidrothbauer at gmail dot com
http://www.linkedin.com/pub/david-rothbauer/5/923/518
codeismydrug.wordpress.com
hl7coders.wordpress.com

Test all my code suggestions prior to implementation
Reply With Quote
  #3  
Old 11-23-2011, 11:40 AM
ehobbs ehobbs is offline
Mirth Newb
 
Join Date: Jul 2011
Posts: 7
ehobbs is on a distinguished road
Default

You had it exactly right. One little missing '=' is all it takes to really mess things up. I hate it when I pound my head against the wall trying to figure out why something won't work and it turns out to be a stupid typo.

Thanks,

Ed
Reply With Quote
  #4  
Old 11-24-2011, 04:47 AM
Bostad Bostad is offline
Level 85 Channel Wizard
 
Join Date: Mar 2009
Location: Stratford Ontario
Posts: 712
Bostad is an unknown quantity at this point
Default

lol, if you look at the posts I made when I first started here you will see that problem exactly and much more besides!

Sometimes all it takes is a second set of eyes!
__________________
I can be reached through gmail and Google Talk using davidrothbauer at gmail dot com
http://www.linkedin.com/pub/david-rothbauer/5/923/518
codeismydrug.wordpress.com
hl7coders.wordpress.com

Test all my code suggestions prior to implementation
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 08:32 AM.


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