-
I'm trying to build out a transformer that crosswalks the OBR.4.1 value. For example, if the OBR.4.1 value is 111, change it to AAA. I know how to do this hardcoded, but it's going to be a lot easier to import a csv file to the db, and use that. I've built a table in postgresql that has an input and output column. I did my first pass at the transformer, but instead of spitting out "AAA" in OBR.4.1, populated OBR.4.1 as this: com.mirth.connect.server.userutil.MirthCachedRowSet@4a619dc9 Can someone help me figure out what I've done wrong? `var dbConn = DatabaseConnectionFactory.createDatabaseConnection( var input = msg['OBR']['OBR.4']['OBR.4.1'].toString() var sql = "SELECT output FROM crosswalk WHERE input= '" + input + "'"; var output = dbConn.executeCachedQuery(sql); if (output) { |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
You need to call result.next(). How big is the crosswalk table though? And stop doing inline connection building like that, it's dumb. Do something like https://github.com/pacmano1/Mirth-Snippets/blob/main/executeSharedDBStatement.js |
Beta Was this translation helpful? Give feedback.
it is likely much better to load that table to a $g object as an object and just do the lookup directly.