web stats
Javawriter DB query into local variables - Mirth Community

Go Back   Mirth Community > Mirth Connect > Development

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-31-2013, 08:59 AM
appsbyaaron's Avatar
appsbyaaron appsbyaaron is offline
Mirth Guru
 
Join Date: Nov 2011
Location: Florida, USA
Posts: 377
appsbyaaron is on a distinguished road
Default Javawriter DB query into local variables

I have a Javawriter connector that is running an Oracle query to pull back 2 fields from a table. How do I put those two values into a variable (channel map)?

I've tried the following:

var var_batch_count;
var var_error_text;
var local_batch_id = channelMap.get('temp_batch_id');

//Call CHIRP HL7 Function Part 1
var temp_SQL = 'SELECT COUNT (se.batch_id) as var_batch_count, se.ERROR_TEXT as var_error_text FROM h33_hl7_send_error se WHERE se.batch_id = ' + local_batch_id + ' AND TRUNC (se.received) = TRUNC (SYSDATE - 1) AND se.message_type_received = ' + 'ACK' + ' AND se.is_error = ' + 'Y' + 'GROUP BY se.batch_id, se.ERROR_TEXT';
var temppw = 'secret password';
var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('connection string data');

var result = dbConn.executeCachedQuery(temp_SQL);

var_batch_count = dbConn.executeCachedQuery(temp_SQL.var_batch_count);
var_error_text = dbConn.executeCachedQuery(temp_SQL.var_error_text);

channelMap.put('temp_total_count',var_batch_count) ;
channelMap.put('temp_error_count',var_error_text);
Reply With Quote
 

Tags
channelmap, javawriter, oracle, sql

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:59 AM.


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