web stats
channel map value not able to fetch from transformer when queue message : Always - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-03-2018, 11:24 PM
shuhaibk54 shuhaibk54 is offline
Mirth Newb
 
Join Date: Jan 2018
Location: Abudhabi
Posts: 23
shuhaibk54 is on a distinguished road
Send a message via AIM to shuhaibk54 Send a message via Skype™ to shuhaibk54
Post channel map value not able to fetch from transformer when queue message : Always

Hello ,

I am facing some weird issue when I enable queue message : Always . There is no issue with option queue message : Never or On faliure . This channel perform result fetch from MLLP and Write to DB .

Error I am getting when I make queue message : Always

JavaScript Writer error
ERROR MESSAGE: Error evaluating JavaScript Writer
com.mirth.connect.server.MirthJavascriptTransforme rException:
CHANNEL: WelchAllyn_Vital device_ORU
CONNECTOR: Inserto_Gen_Pat_Report
SCRIPT SOURCE: JavaScript Writer
SOURCE CODE:
121: params.set(5,$('MessageControlId'));
122:
123: logger.info("sIZE OF THE OBSERVATION");
124: for each (observation in $('observations'))
125: {
126: params.set(6,observation.Id);
127: params.set(7,observation.ObservationValue);
128: params.set(8,observation.UnitsIdentifier);
129: params.set(9, observation.send);
130: dbConn.executeUpdate(insertQuery, params);
LINE NUMBER: 126
DETAILS: Java class "[B" has no public instance field or method named "Id".
at 9a556f1b-ca74-4fa6-baca-cbe18ff836b2:126 (doScript)
at 9a556f1b-ca74-4fa6-baca-cbe18ff836b2:143
at com.mirth.connect.connectors.js.JavaScriptDispatch er$JavaScriptDispatcherTask.doCall(JavaScriptDispa tcher.java:184)
at com.mirth.connect.connectors.js.JavaScriptDispatch er$JavaScriptDispatcherTask.doCall(JavaScriptDispa tcher.java:122)
at com.mirth.connect.server.util.javascript.JavaScrip tTask.call(JavaScriptTask.java:113)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
at java.lang.Thread.run(Unknown Source


-------------------------My source transformer code -------------------------
var field1,field2;
$c('MessageControlId',msg['MSH']['MSH.10']['MSH.10.1'].toString());
$c('PatientId',msg['PID']['PID.3']['PID.3.1'].toString());
$c('PatientVisitId',msg['PV1']['PV1.1']['PV1.1.1'].toString());
$c('observations',[]);
var sql="select FIELD1,FIELD2,FIELD3,FIELD4 from gen_lookup where lookup_type='HL7_SETTING' and LOOKUP_VALUE='VITALS MAPPING'";
var gen_lookup= Fun_Select(sql);
var gen_lookup2= Fun_Select(sql);
for each (obx in msg.OBX)
{
var observation = {};
observation.Id = obx['OBX.3']['OBX.3.1'].toString();
observation.send=obx['OBX.3']['OBX.3.1'].toString();
field1=checkfield(gen_lookup,observation.Id);
observation.Id = field1;
observation.UnitsIdentifier = obx['OBX.6']['OBX.6.1'].toString();

field2=checkfield2(gen_lookup2,observation.UnitsId entifier);
observation.UnitsIdentifier=field2;
observation.ObservationValue = obx['OBX.5']['OBX.5.1'].toString();
$c('observations').push(observation);
}

function checkfield(gen_lookup,observationId)
{
try
{
var value1,value2;
while(gen_lookup.next())
{
value1=gen_lookup.getString('FIELD1');
value2=gen_lookup.getString('FIELD2');
if(value1==observationId)
{
gen_lookup.first();
return value2;
}
}
}
catch(e)
{
logger.info("Catch error"+e);
}

}

function checkfield2( gen_lookup2,observationDet)
{
try
{
var value1,value2;

while(gen_lookup2.next())
{
value1=gen_lookup2.getString('FIELD3');
value2=gen_lookup2.getString('FIELD4');
if(value1==observationDet)
{
return value2;
}
}
}
catch(e)
{
logger.info("Catch error"+e);
}
}
------------------My destination transformer code ----------------------

//try

importPackage(java.sql);
var CurDate = DateUtil.getCurrentDate("dd-MM-yy");
var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('oracle.jdbc.driver.OracleDriver','jdbcracle:th in:@XXXXX:XXXX','XXXX','XXXX');
var insertQuery="insert into GEN_PAT_REPORT(GEN_PAT_REPORT_ID,MRNO,VISIT_NO,REP ORT_DATE,ENTRY_DATE,REPORT_TYPE,MESSAGE_CONTROL_ID ,FIELD1,FIELD2,FIELD3,FIELD4) VALUES(SEQ_GEN_PAT_REPORT.nextval,?,?,?,?,?,?,?,?, ?,?)";
var params = new java.util.ArrayList([$('PatientId'),$('PatientVisitId'), null,null, null, null,null, null, null,null]);
params.set(2,CurDate);
params.set(3,CurDate);
params.set(4,'7');
params.set(5,$('MessageControlId'));

logger.info("sIZE OF THE OBSERVATION");
for each (observation in $('observations'))
{
params.set(6,observation.Id);
params.set(7,observation.ObservationValue);
params.set(8,observation.UnitsIdentifier);
params.set(9, observation.send);
dbConn.executeUpdate(insertQuery, params);
}
logger.info("New Row's are inserted to GEN_PAT_REPORT");
dbConn.close();

/*finally
{
if(dbConn)
{
dbConn.close();
}
}*/
Reply With Quote
  #2  
Old 06-04-2018, 06:42 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 749
agermano is on a distinguished road
Default

It has to do with the way the channelMap variables must be serialized and retrieved from the db in order to process a queued message. Your javascript array is getting converted to a java byte[].You probably would have the same issue with queuing on failure if a message were ever actually queued.

At the end of your source transformer:

Code:
$c('observations',JSON.stringify($c('observations')));
In your destination transformer:

Code:
for each (observation in JSON.parse($('observations')))
Converting your object to and from JSON in the channelMap should preserve your values.
Reply With Quote
Reply

Tags
channel map, queue, transformed data

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


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