web stats
UNDEFINED issues - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 11-06-2006, 06:33 AM
arumpke arumpke is offline
Mirth Newb
 
Join Date: Oct 2006
Posts: 23
arumpke
Default UNDEFINED issues

I have a SQL database to FileWriter outbound channel. Things seem to work well unless the field is NULL in the database. I then receive "undefined" in the message for that field. I saw the post on 10/09/2006 "Database reader to file writer" and it looks like the same issue. I cannot get the .toString() to work. I am just using mapping and this is what I have:
.toString(msg['patientsuffix'])

Any suggestions?
Thanks!
Reply With Quote
  #2  
Old 11-06-2006, 11:35 AM
chrisl chrisl is offline
Mirth Employee
 
Join Date: Aug 2006
Posts: 967
chrisl is an unknown quantity at this point
Default Re: UNDEFINED issues

This is the proper syntax

msg['patientsuffix'].toString()

Let me know if that works!
-Chris
__________________
Chris Lang
Reply With Quote
  #3  
Old 11-06-2006, 12:15 PM
arumpke arumpke is offline
Mirth Newb
 
Join Date: Oct 2006
Posts: 23
arumpke
Default Re: UNDEFINED issues

Thanks for the help. Unfortunately it did not work. I receive a "TypeError: Cannot find function text. "

Any further ideas are appreciated!
Reply With Quote
  #4  
Old 11-06-2006, 01:09 PM
chrisl chrisl is offline
Mirth Employee
 
Join Date: Aug 2006
Posts: 967
chrisl is an unknown quantity at this point
Default Re: UNDEFINED issues

"TypeError: Cannot find function text. "

This is caused by some other code in your Javascript - can you paste the full code?
__________________
Chris Lang
Reply With Quote
  #5  
Old 11-06-2006, 03:17 PM
arumpke arumpke is offline
Mirth Newb
 
Join Date: Oct 2006
Posts: 23
arumpke
Default Re: UNDEFINED issues

Here is my channel. It is pretty basic. Thanks for looking at it.


<com.webreach.mirth.model.Channel>
<id>10</id>
<name>Test Outbound</name>
<description>line1&#x0D;line2&#x0D;line3&#x0D;</description>
<enabled>true</enabled>
<version>1.1.0</version>
<revision>0</revision>
<direction>OUTBOUND</direction>
<mode>ROUTER</mode>
<sourceConnector>
<name>sourceConnector</name>
<properties>
<property name="pollingFrequency" value="5000"/>
<property name="username" value="sa"/>
<property name="DataType" value="Database Reader"/>
<property name="useAck" value="1"/>
<property name="URL" value="jdbc:jtds:sqlserver://andi2:1433/mirth"/>
<property name="query" value="SELECT &#x0D;patientidexternal, &#x0D;patientidinternal,&#x0D;patientlast, &#x0D;patientfirst,&#x0D;patientmiddle, &#x0D;patientsuffix,&#x0D;patientprefix,&#x0D;pati entbirthdate,&#x0D;patientsex&#x0D;FROM ToCentricity WHERE SentToFile IS NULL;&#x0D;&#x0D;"/>
<property name="password" value="password"/>
<property name="host" value="query"/>
<property name="driver" value="net.sourceforge.jtds.jdbc.Driver"/>
<property name="ack" value="UPDATE ToCentricity SET SentToFile = GetDate()&#x0D;WHERE patientidexternal = ${patientidexternal}"/>
</properties>
<transformer>
<steps/>
</transformer>
<filter>
<rules/>
</filter>
<transportName>Database Reader</transportName>
</sourceConnector>
<destinationConnectors>
<com.webreach.mirth.model.Connector>
<name>Destination 2</name>
<properties>
<property name="outputAppend" value="1"/>
<property name="DataType" value="File Writer"/>
<property name="outputPattern" value="${DATE:yy-MM-dd}${UUID}.HL7"/>
<property name="template" value=" ${HL7 ER7}"/>
<property name="host" value="c:/test2"/>
</properties>
<transformer>
<steps>
<com.webreach.mirth.model.Step>
<sequenceNumber>0</sequenceNumber>
<name>New Step</name>
<script>hl7_xml[&apos;PID&apos;][&apos;PID.2&apos;][&apos;CX.1&apos;].text()[0] = msg[&apos;patientidexternal&apos;].text()[0];</script>
<type>HL7 Message Builder</type>
<data class="map">
<entry>
<string>Mapping</string>
<string>msg[&apos;patientidexternal&apos;]</string>
</entry>
<entry>
<string>Variable</string>
<string>hl7_xml[&apos;PID&apos;][&apos;PID.2&apos;][&apos;CX.1&apos;]</string>
</entry>
</data>
</com.webreach.mirth.model.Step>
<com.webreach.mirth.model.Step>
<sequenceNumber>1</sequenceNumber>
<name>New Step</name>
<script>hl7_xml[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.1&apos;].text()[0] = msg[&apos;patientlast&apos;].text()[0];</script>
<type>HL7 Message Builder</type>
<data class="map">
<entry>
<string>Mapping</string>
<string>msg[&apos;patientlast&apos;]</string>
</entry>
<entry>
<string>Variable</string>
<string>hl7_xml[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.1&apos;]</string>
</entry>
</data>
</com.webreach.mirth.model.Step>
<com.webreach.mirth.model.Step>
<sequenceNumber>2</sequenceNumber>
<name>New Step</name>
<script>hl7_xml[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.2&apos;].text()[0] = msg[&apos;patientfirst&apos;].text()[0];</script>
<type>HL7 Message Builder</type>
<data class="map">
<entry>
<string>Mapping</string>
<string>msg[&apos;patientfirst&apos;]</string>
</entry>
<entry>
<string>Variable</string>
<string>hl7_xml[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.2&apos;]</string>
</entry>
</data>
</com.webreach.mirth.model.Step>
<com.webreach.mirth.model.Step>
<sequenceNumber>3</sequenceNumber>
<name>New Step</name>
<script>hl7_xml[&apos;PID&apos;][&apos;PID.3&apos;][&apos;CX.1&apos;].text()[0] = msg[&apos;patientidinternal&apos;].text()[0];</script>
<type>HL7 Message Builder</type>
<data class="map">
<entry>
<string>Mapping</string>
<string>msg[&apos;patientidinternal&apos;]</string>
</entry>
<entry>
<string>Variable</string>
<string>hl7_xml[&apos;PID&apos;][&apos;PID.3&apos;][&apos;CX.1&apos;]</string>
</entry>
</data>
</com.webreach.mirth.model.Step>
<com.webreach.mirth.model.Step>
<sequenceNumber>4</sequenceNumber>
<name>New Step</name>
<script>hl7_xml[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.3&apos;].text()[0] = msg[&apos;patientmiddle&apos;].text()[0];</script>
<type>HL7 Message Builder</type>
<data class="map">
<entry>
<string>Mapping</string>
<string>msg[&apos;patientmiddle&apos;]</string>
</entry>
<entry>
<string>Variable</string>
<string>hl7_xml[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.3&apos;]</string>
</entry>
</data>
</com.webreach.mirth.model.Step>
<com.webreach.mirth.model.Step>
<sequenceNumber>5</sequenceNumber>
<name>New Step</name>
<script>hl7_xml[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.4&apos;].text()[0] = msg[&apos;patientsuffix&apos;].toString().text()[0];</script>
<type>HL7 Message Builder</type>
<data class="map">
<entry>
<string>Mapping</string>
<string>msg[&apos;patientsuffix&apos;].toString()</string>
</entry>
<entry>
<string>Variable</string>
<string>hl7_xml[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.4&apos;]</string>
</entry>
</data>
</com.webreach.mirth.model.Step>
<com.webreach.mirth.model.Step>
<sequenceNumber>6</sequenceNumber>
<name>New Step</name>
<script>hl7_xml[&apos;PID&apos;][&apos;PID.7&apos;][&apos;TS.1&apos;].text()[0] = msg[&apos;patientbirthdate&apos;].text()[0];</script>
<type>HL7 Message Builder</type>
<data class="map">
<entry>
<string>Mapping</string>
<string>msg[&apos;patientbirthdate&apos;]</string>
</entry>
<entry>
<string>Variable</string>
<string>hl7_xml[&apos;PID&apos;][&apos;PID.7&apos;][&apos;TS.1&apos;]</string>
</entry>
</data>
</com.webreach.mirth.model.Step>
<com.webreach.mirth.model.Step>
<sequenceNumber>7</sequenceNumber>
<name>New Step</name>
<script>hl7_xml[&apos;PID&apos;][&apos;PID.8&apos;].text()[0] = msg[&apos;patientsex&apos;].text()[0];</script>
<type>HL7 Message Builder</type>
<data class="map">
<entry>
<string>Mapping</string>
<string>msg[&apos;patientsex&apos;]</string>
</entry>
<entry>
<string>Variable</string>
<string>hl7_xml[&apos;PID&apos;][&apos;PID.8&apos;]</string>
</entry>
</data>
</com.webreach.mirth.model.Step>
<com.webreach.mirth.model.Step>
<sequenceNumber>8</sequenceNumber>
<name>New Step</name>
<script>hl7_xml[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.5&apos;].text()[0] = msg[&apos;patientprefix&apos;].text()[0];</script>
<type>HL7 Message Builder</type>
<data class="map">
<entry>
<string>Mapping</string>
<string>msg[&apos;patientprefix&apos;]</string>
</entry>
<entry>
<string>Variable</string>
<string>hl7_xml[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.5&apos;]</string>
</entry>
</data>
</com.webreach.mirth.model.Step>
</steps>
<template>MSH|^~\&amp;|SENDING|01|RECEIVING|97|||A DT^A04|20061016111646012|P|2.3|||||&#x0D;EVN|A04|2 0061016111646|01|&#x0D;PID||123456|01234567||MOUSE ^Mickey^J^SR^Mr||19500110|M||W|123 MAIN CT^APT2^Magic Kingdom^FL^99999||513-555-5555|513-555-5555||||123456789|123456789&#x0D;NK1|1|UNEMPLOYED| |^^^^|||PTEMP||||||||||||||||||||||||||||&#x0D;PV1 ||I||||||^DOCTORLAST^DOCTORFIRST^MIDDLE^SUFFIX^PRE FIX|||||||||||||||||||||||||||||||01|||||||&#x0D;G T1||500|MOUSE^Mickey^J^SR^Mr||123 MAIN CT^APT2^Magic Kingdom^FL^99999|513-555-5555|513-555-5555||||P|999999999||||UNEMPLOYED|123 Main Street^Suite 2^Magic Kingdom^FL^99999||&#x0D;IN1|1|0558|1|BLUE CROSS||||123||||||XXXXX||MOUSE^Minnie^M^SR^Mrs|02| ||||||||||||||||||XXX123X45678||||||||||||||B|0914 2006|&#x0D;IN1|2|0001|2|MEDICARE||||456||||||XXXXX ||MOUSE^Minnie^M^SR^Mrs|02|||||||||||||||||||99999 99||||||||||||||B|09142006|&#x0D;</template>
</transformer>
<filter>
<rules/>
<template></template>
</filter>
<transportName>File Writer</transportName>
</com.webreach.mirth.model.Connector>
</destinationConnectors>
<properties>
<property name="initialState" value="stopped"/>
<property name="recv_xml_encoded" value="false"/>
</properties>
</com.webreach.mirth.model.Channel>
Reply With Quote
  #6  
Old 11-06-2006, 03:56 PM
chrisl chrisl is offline
Mirth Employee
 
Join Date: Aug 2006
Posts: 967
chrisl is an unknown quantity at this point
Default Re: UNDEFINED issues

Ah - this is an issue with Mirth 1.1.0 - it appends .text()[0] to your mappings, making the .toString() fail.


The best bet would be to upgrade to 1.2. If this is not an option, change the msg['patientsuffix'].toString().text()[0]; mapping to a Javascript step and use the following syntax:

hl7_xml['PID']['PID.5']['XPN.4'].text()[0] = msg['patientsuffix'].toString();

-Chris
__________________
Chris Lang
Reply With Quote
  #7  
Old 11-06-2006, 09:05 PM
arumpke arumpke is offline
Mirth Newb
 
Join Date: Oct 2006
Posts: 23
arumpke
Default Re: UNDEFINED issues

Chris,
Thanks so much. I just changed to a Javascript and actually changed the syntax to:
hl7_xml['PID']['PID.5']['XPN.4'] = msg['patientsuffix'].toString();

It worked!! I really appreciate the help. I look forward to upgrading to 1.2.
Andi
Reply With Quote
  #8  
Old 11-07-2006, 02:02 PM
chrisl chrisl is offline
Mirth Employee
 
Join Date: Aug 2006
Posts: 967
chrisl is an unknown quantity at this point
Default Re: UNDEFINED issues

Glad it worked! Let me know if you have any other issues.

-Chris
__________________
Chris Lang
Reply With Quote
Reply

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
WS: Use of undefined namespace prefix bolota Support 2 06-15-2010 12:31 PM
Undefined result set... possible to create empty? trymirth Support 6 06-03-2008 11:26 AM
Got a result of: org.mozilla.javascript.Undefined tadigiri Support 0 05-26-2008 05:01 AM
First value in Javascript is always undefined RobinP Development 2 05-03-2008 05:57 AM
Undefined in OBX Segment bobbie Support 5 01-11-2007 08:11 AM


All times are GMT -8. The time now is 11:24 PM.


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