Announcement

Collapse
No announcement yet.

UNDEFINED issues

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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!

  • #2
    Re: UNDEFINED issues

    This is the proper syntax

    msg['patientsuffix'].toString()

    Let me know if that works!
    -Chris
    Chris Lang

    Comment


    • #3
      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!

      Comment


      • #4
        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

        Comment


        • #5
          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>

          Comment


          • #6
            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[&#039;patientsuffix&#039;].toString().text()[0]; mapping to a Javascript step and use the following syntax:

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

            -Chris
            Chris Lang

            Comment


            • #7
              Re: UNDEFINED issues

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

              It worked!! I really appreciate the help. I look forward to upgrading to 1.2.
              Andi

              Comment


              • #8
                Re: UNDEFINED issues

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

                -Chris
                Chris Lang

                Comment

                Working...
                X