web stats
Reading Multiple Rows - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-29-2014, 12:54 PM
Biggs Biggs is offline
Mirth Newb
 
Join Date: Dec 2014
Posts: 18
Biggs is on a distinguished road
Default Reading Multiple Rows

Im trying to filter a message received based off of a query. If the messages facility number matches any of the numbers returned from the query then allow the message to go through. If it doesnt then stop the message. Below is my code that I have in the destination's filter.

var i = 1;
var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sql server://"":1433;DatabaseName=""','mirth','mirth');
var result = dbConn.executeCachedQuery("SELECT FACILITY FROM INTERFACE_IP_ADDR WHERE INTERFACE = 'NAME'");
while(result.next())
{
var f = result.getString(i);
if($('msg_rcv_fac') == f)
{
return true;
}
else
{
exit;
}
i++;
}
Reply With Quote
  #2  
Old 12-30-2014, 05:17 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,277
cory_cole is on a distinguished road
Default

SELECT FACILITY FROM INTERFACE_IP_ADDR WHERE INTERFACE = 'NAME' AND FACILITY = 'f'

This way you would only need the query and not have to do the if.
Reply With Quote
  #3  
Old 12-30-2014, 07:37 AM
Biggs Biggs is offline
Mirth Newb
 
Join Date: Dec 2014
Posts: 18
Biggs is on a distinguished road
Default

Thank you. Your solution works. I didnt think of doing that.
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 10:16 AM.


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