web stats
global function and database connection - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 09-11-2014, 12:47 PM
johnjohn johnjohn is offline
OBX.1 Kenobi
Join Date: Aug 2014
Posts: 31
johnjohn is on a distinguished road
Default global function and database connection

I have 2000 charge files need to be processed at 10:00 pm everyday. I am thinking to create function in the code template that other channels can use it. I will pass a P1 segment and extract fields from it, e.g. patient name, dob, address, sex...I want to do a database connection using

var dbConn =
DatabaseConnectionFactory.createDatabaseConnection ("org.postgresql.Driver",
'jdbcostgresql://localhost:5432/mirthtraining', 'mirthtraining',
var result = dbConn.executeCachedQuery('SELECT * FROM person');

I will use the function call in the filter javascript. Do I need to do the database connection for each record being read? The function should do a database query that if the patient is found return the MRN. What is the most efficient way to do it? I am confused and your help is appreciated. (mirth 3.01.7051)
Reply With Quote

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 05:16 PM.

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