Hi everyone, please check out our new discussion forum located in our GitHub site: https://github.com/nextgenhealthcare/connect/discussions. Let us know your feedback as we try out this new part of GitHub! Don't worry, the content in these forums won't be going away and will at a minimum be preserved for historical reference.
Announcement
Collapse
Mirth Connect 4.3.0 Released!
Mirth Connect 4.3.0 is now available as an appliance update and on our GitHub page.
This is a major release containing new features like adding new functionality to the Mirth Connect Setup Wizard, adding the ability for resource and channel-specific classloaders to load child-first or parent-first, and added a default implementation of the getObjectsForSwaggerExamples() method in the ServicePlugin class. This release also contains enhancements for the Mirth Connect Administrator Launcher, the Mirth Connect Docker images, and several bug fixes and security improvements.
I have created a transformer that needs to Perform a Database Query. I have tried different things but I keep getting invalid syntax when I try and deploy my channel. Does anyone have a working example. What I am trying to do is take a value that I am recieving and go to the database and replace it with a different value.
var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('sqlserver', 'HL7_Test', 'webvmc', 'webvmc'
var result = dbConn.executeCachedQuery('Select StateID FROM State WHERE Abbreviation = SC'
dbConn.close();
return result;
What I will eventually want to do is replace SC with msg['PID']['PID.11']['XAD.4'] if it will do that.
1. You need to make sure this is in a Javascript step rather than a mapping step. While you can execute some code in the mapping steps, they will attempt to assign the result of the execution to a var (and the use of "return" is not allowed).
2. In your database connection, you are just passing it "sqlserver". This needs to be the full JDBC connection string for the database:
Code:
You SQL Server connection string could be something like this:
jdbc:jtds:sqlserver://localhost:1433;databaseName=mydatabase;domain=mydomain
I have my database connection working. It is getting to the database. Now I need the value from my select statement. My select statement only returns 1 value and it is an int. 'select StateId from state where abbrv = 'SC''. My return value is 36. I am not able to get anything from the result of the executeCachedQuery. It puts it in some sort of cached resultset and I don't know how to get it out. IF anyone has an example that would be great. Or if there is a better way please let me know.
var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('net.sourceforge.jtds.jdbc.Driver', 'jdbc:jtds:sqlserver://localhost:1433/HL7_Test', 'user', 'pass'
var result = dbConn.executeCachedQuery('Select StateId from State where abbreviation = ' + "'" + msg['PID']['PID.11']['XAD.4'].toString() + "'");
var returnval = result.getInt(0);
localMap.put('StateId', returnval);
dbConn.close();
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, personalize advertising, and to analyze site activity. We may share certain information about our users with our advertising and analytics partners. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment