web stats
Filter messages in transformer - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 01-27-2016, 10:26 PM
mnowlin mnowlin is offline
OBX.3 Kenobi
 
Join Date: Sep 2006
Posts: 141
mnowlin is an unknown quantity at this point
Default Filter messages in transformer

Maybe I'm missing something simple.... Is it possible to filter messages in a transformer? I have a situation where I know an outgoing message is going to fail, but that can only be determined after the transformer steps have done their slicing and dicing. I've tried a bunch of things, but no luck so far... Primary target is Mirth 3.0.1.

Thanks, Mike
Reply With Quote
  #2  
Old 01-27-2016, 11:43 PM
rauchj rauchj is offline
OBX.1 Kenobi
 
Join Date: Feb 2014
Location: Freiburg, Germany
Posts: 43
rauchj is on a distinguished road
Default

Which Transformer do you use, source or destination? Keep in mind that you can filter in source and each destination. So if you transform the message in the source transformer you could use the destination filter to select the correct messages before sending them
Reply With Quote
  #3  
Old 01-28-2016, 04:18 AM
jadams4's Avatar
jadams4 jadams4 is offline
OBX.3 Kenobi
 
Join Date: Aug 2015
Posts: 143
jadams4 is on a distinguished road
Default

Hi mnowlin,

If I am understanding you correctly, you want to use a transformer step to remove the destination instead of a filter. If this is correct, you can see a great example of how to do this in the most recent webinar from Mirth. Here is a simple example as well:

Code:
//checking to see if message is from hospital A
if(msg['MSH']['MSH.3']['MSH.3.1'].toString() == "Hospital A"){
        //if from hospital a, remove destination with ID of 1
	destinationSet.remove([1]);
}
If you look at the destinations tab, each destination will have an ID. You can use that ID to remove or add the destination in the transformers.
Reply With Quote
  #4  
Old 01-28-2016, 04:33 AM
appsbyaaron's Avatar
appsbyaaron appsbyaaron is offline
Mirth Guru
 
Join Date: Nov 2011
Location: Florida, USA
Posts: 377
appsbyaaron is on a distinguished road
Default

https://www.mirth.com/Client-Portal#developerqa/91

Very good to know! Thanks!
Reply With Quote
  #5  
Old 01-28-2016, 08:27 PM
mnowlin mnowlin is offline
OBX.3 Kenobi
 
Join Date: Sep 2006
Posts: 141
mnowlin is an unknown quantity at this point
Default

Interesting - I'll give that a try.

Thanks, Mike
Reply With Quote
  #6  
Old 06-06-2019, 09:09 AM
anderson.araujo anderson.araujo is offline
Mirth Newb
 
Join Date: Jul 2015
Location: Brazil, Rio de Janeiro
Posts: 17
anderson.araujo is on a distinguished road
Default

Hi jadams4,

Very interesting this functionality, but when I try to use it I'm getting this error: "InternalError: Java class "com.mirth.connect.server.userutil.Destination Set" has no public instance field or method named "remove". (5ed3ab56-e9fc-47ae-8c5c-6a03975c805e#245)"

My code:
var an_paciente_existe = '';
var erro_consulta_paciente = '';
var result_sql_consulta_paciente;
var sql_consulta_paciente = "SELECT id_atend from Atendimento WHERE id_atend = '" + CodigoAN + "' ";
result_sql_consulta_paciente = dbConn.executeCachedQuery(sql_consulta_paciente);
while(result_sql_consulta_paciente.next()){
an_paciente_existe = result_sql_consulta_paciente.getString("id_atend") ;
logger.info('an_paciente_existe ' + an_paciente_existe);
}
if(an_paciente_existe != ''){
logger.info('RETURN FALSE');
DestinationSet.remove(DestinationSet[1]);

}

Help me ? Thx!
Reply With Quote
  #7  
Old 06-07-2019, 11:10 AM
jg12345 jg12345 is offline
OBX.2 Kenobi
 
Join Date: Oct 2012
Posts: 98
jg12345 is on a distinguished road
Default

I think the problem is the last line. It should show as:

destinationSet.remove(1);
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 02:21 AM.


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