|
#1
|
|||
|
|||
|
Hello,
I want to create a message for each messageid using a data base table with following data MessageID input StatusMSG0001 msg['EVN']['EVN.2']['EVN.2.1'] ='0' 0 MSG0001 msg['MSH']['MSH.7']['MSH.7.1'] ='20120504' 0 MSG0001 msg['MSH']['MSH.9']['MSH.9.1'] ='ADT' 0 MSG0001 msg['MSH']['MSH.9']['MSH.9.2'] ='A04' 0 MSG0001 msg['MSH']['MSH.9']['MSH.9.3'] ='ADT_A04' 0 MSG0001 msg['MSH']['MSH.10'] ='MSG0001' 0 MSG0001 msg['MSH']['MSH.11']['MSH.11.1'] ='T' 0 MSG0001 msg['MSH']['MSH.12']['MSH.12.1'] ='2.5' 0 MSG0001 msg['PID']['PID.3']['PID.3.1'] ='1' 0 MSG0001 msg['PID']['PID.5']['PID.5.1']['PID.5.1.1'] ='Renu' 0 MSG0001 msg['PV1']['PV1.2'] ='IPD' 0 I have taken taken source as database reader with JS and in source transformer written a script as follows var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sql server://192.168.1.21:1433/HealthNote','MirthUser','iwork07'); var result = dbConn.executeCachedQuery("SELECT ID, MessageID, MessageType, input, Status, Segement FROM v_MirthInput WHERE (Status = 0) AND (MessageID = N'MSG0001')"); while (result.next()) {var example = (result.getString('field_name') != null)?result.getString('field_name'):"" ; tmp = result.getString('input'); } and in outbound template MSH|^~\&|||||||||| EVN||||||||||||||||||| PID||||||||||||||||||| PV1||||||||||||||||||| when I deploy the channel I am getting error [2012-05-05 17:27:47,265] ERROR (com.mirth.connect.connectors.jdbc.JdbcMessageRece iver:228): org.mozilla.javascript.EcmaError: ReferenceError: "result" is not defined. (fb7db4e6-9481-4a6c-ac9c-57103580f52f#413) Please guide |
|
#2
|
|||
|
|||
|
MessageID = N'MSG0001' is this a typo? Is this what you want? What is the meaning behind N'MSG0001'?
|
|
#3
|
|||
|
|||
|
Message ID is message control id and the input is the field in tmp.
|
|
#4
|
|||
|
|||
|
Does the stacktrace show exactly where the code is failing?
|
|
#5
|
|||
|
|||
|
The N is outside the quotes. That will cause an error on the database side and make that a null item.
|
|
#6
|
|||
|
|||
|
I don't think that the N prefix would cause an error, much less that specific error you're seeing. Does the stacktrace show exactly where the code is failing?
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|