Currently, I have an inbound LLP reader writing out to a mysql database containing a good deal of the information about the message. In certain messages I have, (like the multiple insurance case) I would like to insert all of those segments into a database. Of course, i wont be knowing how many segments I will be receiving.
I have tried the following in the main SQL statement, but I dont think it likes multiple statements and while loops there. Im not sure.
I was going to try and hack together something inside the transformer using the database connection that can be made there, but I also had problems as well.
Regardless of whether i have something as complex as that in the transformer... or something as simple as the following which i just did to see what is making the transformer fail. Apparently it doesnt like anything at all but the most basic msg['DG1']['DG1.1'] type entry.
I get a gigantic transformer error.
Can somebody help me figure out what may be wrong here? Thank you very much.
Justin
I have tried the following in the main SQL statement, but I dont think it likes multiple statements and while loops there. Im not sure.
Code:
var i = 0; while(msg['DG1']['DG1.4'][i] != null) { Insert into ... }
Code:
var driver = "com.mysql.jdbc.Driver"; var address = "jdbc:mysql://localhost/rawhl7;"; var username = "user"; var password = "password"; var i = 0; var patientID = msg['PID']['PID.3']['CX.1']; var dbConn = DatabaseConnectionFactory.createDatabaseConnection(driver,address,username,password); while(msg['DG1']['DG1.4'][i] != null) { var complaintNumber = msg['DG1']['DG1.1'][i]; var complaint = msg['DG1']['DG1.4'][i]; var expression = "INSERT IGNORE INTO a08_complaints values (DEFAULT, '" + patientID + "', '" + complaintNumber + "', '" + complaint + "';"; var result = dbConn.executeCachedQuery(expression); result.close(); i++; } dbConn.close();
Code:
return (msg['DG1']['DG1.1']);
ERROR [3_destination_1.dispatcher.1] org.mule.impl.DefaultExceptionStrategy:
************************************************** ******************************
Message : syntax error (<cmd>#1) (org.mozilla.javascript.EvaluatorException)
Type : org.mule.umo.transformer.TransformerException
Code : 64999
Transformer : Transformer{name='3_destination_1', returnClass=false, returnClass=false, sourceTypes=[]}
JavaDoc : http://mule.codehaus.org/docs/apidoc...Exception.html
************************************************** ******************************
Exception stack is:
1. syntax error (<cmd>#1) (org.mozilla.javascript.EvaluatorException)
org.mozilla.javascript.DefaultErrorReporter:95 (null)
2. syntax error (<cmd>#1) (org.mozilla.javascript.EvaluatorException) (org.mule.umo.transformer.TransformerException)
com.webreach.mirth.server.mule.transformers.JavaSc riptTransformer:66 (http://mule.codehaus.org/docs/apidoc...Exception.html)
************************************************** ******************************
Root Exception stack trace:
org.mozilla.javascript.EvaluatorException: syntax error (<cmd>#1)
at org.mozilla.javascript.DefaultErrorReporter.runtim eError(DefaultErrorReporter.java:95)
at org.mozilla.javascript.DefaultErrorReporter.error( DefaultErrorReporter.java:82)
at org.mozilla.javascript.Parser.addError(Parser.java :122)
at org.mozilla.javascript.Parser.reportError(Parser.j ava:128)
at org.mozilla.javascript.Parser.primaryExpr(Parser.j ava:2013)
at org.mozilla.javascript.Parser.memberExpr(Parser.ja va:1640)
at org.mozilla.javascript.Parser.unaryExpr(Parser.jav a:1503)
at org.mozilla.javascript.Parser.mulExpr(Parser.java: 1432)
at org.mozilla.javascript.Parser.addExpr(Parser.java: 1413)
at org.mozilla.javascript.Parser.shiftExpr(Parser.jav a:1393)
at org.mozilla.javascript.Parser.relExpr(Parser.java: 1367)
at org.mozilla.javascript.Parser.eqExpr(Parser.java:1 323)
at org.mozilla.javascript.Parser.bitAndExpr(Parser.ja va:1312)
at org.mozilla.javascript.Parser.bitXorExpr(Parser.ja va:1301)
at org.mozilla.javascript.Parser.bitOrExpr(Parser.jav a:1290)
at org.mozilla.javascript.Parser.andExpr(Parser.java: 1278)
at org.mozilla.javascript.Parser.orExpr(Parser.java:1 266)
at org.mozilla.javascript.Parser.condExpr(Parser.java :1249)
at org.mozilla.javascript.Parser.assignExpr(Parser.ja va:1231)
at org.mozilla.javascript.Parser.argumentList(Parser. java:1595)
at org.mozilla.javascript.Parser.memberExprTail(Parse r.java:1728)
at org.mozilla.javascript.Parser.memberExpr(Parser.ja va:1643)
at org.mozilla.javascript.Parser.unaryExpr(Parser.jav a:1503)
at org.mozilla.javascript.Parser.mulExpr(Parser.java: 1432)
at org.mozilla.javascript.Parser.addExpr(Parser.java: 1413)
at org.mozilla.javascript.Parser.shiftExpr(Parser.jav a:1393)
at org.mozilla.javascript.Parser.relExpr(Parser.java: 1367)
at org.mozilla.javascript.Parser.eqExpr(Parser.java:1 323)
at org.mozilla.javascript.Parser.bitAndExpr(Parser.ja va:1312)
at org.mozilla.javascript.Parser.bitXorExpr(Parser.ja va:1301)
at org.mozilla.javascript.Parser.bitOrExpr(Parser.jav a:1290)
at org.mozilla.javascript.Parser.andExpr(Parser.java: 1278)
at org.mozilla.javascript.Parser.orExpr(Parser.java:1 266)
at org.mozilla.javascript.Parser.condExpr(Parser.java :1249)
at org.mozilla.javascript.Parser.assignExpr(Parser.ja va:1231)
at org.mozilla.javascript.Parser.expr(Parser.java:122 0)
at org.mozilla.javascript.Parser.statementHelper(Pars er.java:1107)
at org.mozilla.javascript.Parser.statement(Parser.jav a:619)
at org.mozilla.javascript.Parser.parseFunctionBody(Pa rser.java:413)
at org.mozilla.javascript.Parser.function(Parser.java :519)
at org.mozilla.javascript.Parser.parse(Parser.java:34 4)
at org.mozilla.javascript.Parser.parse(Parser.java:28 9)
at org.mozilla.javascript.Context.compileImpl(Context .java:2190)
at org.mozilla.javascript.Context.compileString(Conte xt.java:1284)
at org.mozilla.javascript.Context.compileString(Conte xt.java:1273)
at org.mozilla.javascript.Context.evaluateString(Cont ext.java:1129)
at com.webreach.mirth.server.mule.transformers.JavaSc riptTransformer.doTransform(JavaScriptTransformer. java:58)
at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:197)
at org.mule.impl.MuleEvent.getTransformedMessage(Mule Event.java:251)
at org.mule.providers.jdbc.JdbcMessageDispatcher.doDi spatch(JdbcMessageDispatcher.java:88)
at org.mule.providers.AbstractMessageDispatcher$Worke r.run(AbstractMessageDispatcher.java:257)
at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:650)
at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :675)
at java.lang.Thread.run(Unknown Source)
************************************************** ******************************
************************************************** ******************************
Message : syntax error (<cmd>#1) (org.mozilla.javascript.EvaluatorException)
Type : org.mule.umo.transformer.TransformerException
Code : 64999
Transformer : Transformer{name='3_destination_1', returnClass=false, returnClass=false, sourceTypes=[]}
JavaDoc : http://mule.codehaus.org/docs/apidoc...Exception.html
************************************************** ******************************
Exception stack is:
1. syntax error (<cmd>#1) (org.mozilla.javascript.EvaluatorException)
org.mozilla.javascript.DefaultErrorReporter:95 (null)
2. syntax error (<cmd>#1) (org.mozilla.javascript.EvaluatorException) (org.mule.umo.transformer.TransformerException)
com.webreach.mirth.server.mule.transformers.JavaSc riptTransformer:66 (http://mule.codehaus.org/docs/apidoc...Exception.html)
************************************************** ******************************
Root Exception stack trace:
org.mozilla.javascript.EvaluatorException: syntax error (<cmd>#1)
at org.mozilla.javascript.DefaultErrorReporter.runtim eError(DefaultErrorReporter.java:95)
at org.mozilla.javascript.DefaultErrorReporter.error( DefaultErrorReporter.java:82)
at org.mozilla.javascript.Parser.addError(Parser.java :122)
at org.mozilla.javascript.Parser.reportError(Parser.j ava:128)
at org.mozilla.javascript.Parser.primaryExpr(Parser.j ava:2013)
at org.mozilla.javascript.Parser.memberExpr(Parser.ja va:1640)
at org.mozilla.javascript.Parser.unaryExpr(Parser.jav a:1503)
at org.mozilla.javascript.Parser.mulExpr(Parser.java: 1432)
at org.mozilla.javascript.Parser.addExpr(Parser.java: 1413)
at org.mozilla.javascript.Parser.shiftExpr(Parser.jav a:1393)
at org.mozilla.javascript.Parser.relExpr(Parser.java: 1367)
at org.mozilla.javascript.Parser.eqExpr(Parser.java:1 323)
at org.mozilla.javascript.Parser.bitAndExpr(Parser.ja va:1312)
at org.mozilla.javascript.Parser.bitXorExpr(Parser.ja va:1301)
at org.mozilla.javascript.Parser.bitOrExpr(Parser.jav a:1290)
at org.mozilla.javascript.Parser.andExpr(Parser.java: 1278)
at org.mozilla.javascript.Parser.orExpr(Parser.java:1 266)
at org.mozilla.javascript.Parser.condExpr(Parser.java :1249)
at org.mozilla.javascript.Parser.assignExpr(Parser.ja va:1231)
at org.mozilla.javascript.Parser.argumentList(Parser. java:1595)
at org.mozilla.javascript.Parser.memberExprTail(Parse r.java:1728)
at org.mozilla.javascript.Parser.memberExpr(Parser.ja va:1643)
at org.mozilla.javascript.Parser.unaryExpr(Parser.jav a:1503)
at org.mozilla.javascript.Parser.mulExpr(Parser.java: 1432)
at org.mozilla.javascript.Parser.addExpr(Parser.java: 1413)
at org.mozilla.javascript.Parser.shiftExpr(Parser.jav a:1393)
at org.mozilla.javascript.Parser.relExpr(Parser.java: 1367)
at org.mozilla.javascript.Parser.eqExpr(Parser.java:1 323)
at org.mozilla.javascript.Parser.bitAndExpr(Parser.ja va:1312)
at org.mozilla.javascript.Parser.bitXorExpr(Parser.ja va:1301)
at org.mozilla.javascript.Parser.bitOrExpr(Parser.jav a:1290)
at org.mozilla.javascript.Parser.andExpr(Parser.java: 1278)
at org.mozilla.javascript.Parser.orExpr(Parser.java:1 266)
at org.mozilla.javascript.Parser.condExpr(Parser.java :1249)
at org.mozilla.javascript.Parser.assignExpr(Parser.ja va:1231)
at org.mozilla.javascript.Parser.expr(Parser.java:122 0)
at org.mozilla.javascript.Parser.statementHelper(Pars er.java:1107)
at org.mozilla.javascript.Parser.statement(Parser.jav a:619)
at org.mozilla.javascript.Parser.parseFunctionBody(Pa rser.java:413)
at org.mozilla.javascript.Parser.function(Parser.java :519)
at org.mozilla.javascript.Parser.parse(Parser.java:34 4)
at org.mozilla.javascript.Parser.parse(Parser.java:28 9)
at org.mozilla.javascript.Context.compileImpl(Context .java:2190)
at org.mozilla.javascript.Context.compileString(Conte xt.java:1284)
at org.mozilla.javascript.Context.compileString(Conte xt.java:1273)
at org.mozilla.javascript.Context.evaluateString(Cont ext.java:1129)
at com.webreach.mirth.server.mule.transformers.JavaSc riptTransformer.doTransform(JavaScriptTransformer. java:58)
at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:197)
at org.mule.impl.MuleEvent.getTransformedMessage(Mule Event.java:251)
at org.mule.providers.jdbc.JdbcMessageDispatcher.doDi spatch(JdbcMessageDispatcher.java:88)
at org.mule.providers.AbstractMessageDispatcher$Worke r.run(AbstractMessageDispatcher.java:257)
at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:650)
at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :675)
at java.lang.Thread.run(Unknown Source)
************************************************** ******************************
Justin
Comment