web stats
Dynamically read DB and compare to inbound MSG - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 02-21-2016, 05:42 PM
williamKMMI williamKMMI is offline
What's HL7?
 
Join Date: Feb 2016
Posts: 1
williamKMMI is on a distinguished road
Default Dynamically read DB and compare to inbound MSG

Hello all,

I am running into an issue and need help with reading a column in a database table and comparing that with an incoming hl7 message field that is coming from an external source by tcp ip and port. I have my source as a tcp listener channel and in the source transformer, I have the following code:

var dbConn;
var result;
var query = "select distinct NpiNo from WEBRIS_mig..ReferalPhysician" +
" where GroupName in ('EAST TREMONT MEDICAL CENTER','JEROME FAMILY HEALTH CENTER','NY NEURO @ REHAB CENTER')"
+ " and NpiNo != '';";

//try {
dbConn = DatabaseConnectionFactory.createDatabaseConnection ('net.sourceforge.jtds.jdbc.Driver',
'jdbc:jtds:sqlserver://localhost:1433/WEBRIS_Test',
'sa', '1q2w3e4r5t');
result = dbConn.executeCachedQuery(query);


while(dbConn)
{
if(result.next() == msg['PV1']['PV1.7']['PV1.7.1'].toString())
{
return msg;
}
// else
// {
// return false;
// }
}
}
catch(e)
{
logger.error('Database could not execute the request');
}
finally
{
if (dbConn)
{
dbConn.close();
}
}


Someone please provide some feedback on what I am missing. It just filters when I send a message through this channel and I am afraid it may also not be reading the db either.
Reply With Quote
Reply

Tags
compare, database, dynamic, mirth

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 01:04 PM.


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