web stats
Transformation using Database - Mirth Community

Go Back   Mirth Community > Mirth Connect > Development

Reply
 
Thread Tools Display Modes
  #1  
Old 06-25-2019, 11:44 AM
cabanjose367 cabanjose367 is offline
Mirth Newb
 
Join Date: Sep 2018
Posts: 9
cabanjose367 is on a distinguished road
Default Transformation using Database

I would like use a database for Mirth to reference and make a transformation. I will be transforming one insurance code into a different insurance code. So if I have and insurance code 1234 have it transformed into 4321. I have tried to use an array but i have multiple insurances that share the same code on one end but because the mailing address changes the code will be transformed into another code. Im using Mirth Connect 3.8 any help would be appreciated
Reply With Quote
  #2  
Old 06-25-2019, 11:47 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,238
cory_cole is on a distinguished road
Default

Can you be more specific? Do you have a table that has the code transformations?
Reply With Quote
  #3  
Old 06-25-2019, 11:57 AM
cabanjose367 cabanjose367 is offline
Mirth Newb
 
Join Date: Sep 2018
Posts: 9
cabanjose367 is on a distinguished road
Default

Yes the table would have the transformations one column would have the old Insurance iD's and another column would have the new Insurance ID's.
Reply With Quote
  #4  
Old 06-25-2019, 12:08 PM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,238
cory_cole is on a distinguished road
Default

What DB are you using?
Reply With Quote
  #5  
Old 06-25-2019, 12:11 PM
cabanjose367 cabanjose367 is offline
Mirth Newb
 
Join Date: Sep 2018
Posts: 9
cabanjose367 is on a distinguished road
Default

I was hoping I could use the mirth embedded Database since its not a database that will be growing. it is just to hold the values so I can reference
Reply With Quote
  #6  
Old 06-25-2019, 12:19 PM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,238
cory_cole is on a distinguished road
Default

You can use any database for Mirth. Hopefully you are not using Derby. Mirth uses this for demos only and they highly recommend that you a different database when you setup Mirth, as it is not very robust databse. Most commonly used is Postgres. Do you know which DB you set Mirth up with?
Reply With Quote
  #7  
Old 06-25-2019, 12:20 PM
cabanjose367 cabanjose367 is offline
Mirth Newb
 
Join Date: Sep 2018
Posts: 9
cabanjose367 is on a distinguished road
Default

Postgres DB. I just looked to make sure.
Reply With Quote
  #8  
Old 06-25-2019, 12:32 PM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,238
cory_cole is on a distinguished road
Default

You will need to fill in the information specific to your server....

var dbConn;

try {
dbConn = DatabaseConnectionFactory.createDatabaseConnection ('org.postgresql.Driver',IP Address, username, password);

var query = 'SELECT FIELD1 FROM TABLE WHERE FIELD2 = msg....
result = dbConn.executeCashedQuery(query);
while(result.next())
{
var newCode = result.getString(1);
}
} finally {
if (dbConn) {
dbConn.close();
}
}
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 01:24 PM.


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