Mirth Connect 4.1.0 Released!

Mirth Connect 4.1.0 is now available as an appliance update and on our GitHub page. Mirth Connect 4.1.0 includes new features such as new event log messages, additional fields to the Welcome to Mirth Connect screen, new information included in alerts as well as many smaller changes, updates, and improvements. This release also contains several improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Inconsistent behavior of the transformer

  • Filter
  • Time
  • Show
Clear All
new posts

  • Inconsistent behavior of the transformer

    I am using DatabaseReader to read from my MySQL database and passing the data through a Transformer for transforming the SQL data into HL7 A28 message. For the transformation, I use Message Builder and do the following (for example):
    Name: familyname
    Message Segment: tmp['PID']['PID.5']['PID.5.1']
    Mapping: msg['lastname'].toString()

    Where 'lastname' is the SQL field which brings in the familyname. This used to work fine for sometime. But after adding and removing few other fields, the mapping entirely stopped working, even though i revereted to the earlier working version. I don't see any errors during transformation and messages are successfully sent to the FileWriter. When I look at the file written, the familyname field is blank, though my database has data.

    I looked at the Mirth Dashboard and I see that the value for familyname is present in the xml data generated out of the source data. But during the transformation it is lost. Any pointers?

  • #2
    Re:Inconsistent behavior of the transformer

    I have sometimes had the need to prefix the field with the table name.

    i.e. msg['mytable.lastname'].toString()


    • #3
      Re:Inconsistent behavior of the transformer

      I tried that too, it still doesn't bring the data. Is there any other way of mapping the sql returned data to HL7? For example, how do I use javascript for this particular case? I tried the following in the Javascript for this field,

      tmp['PID']['PID.5']['PID.5.1'] = msg['lastname'].toString();

      and it doesn't bring the data too. What is Mirth doing? It doesn't even tell what the issue?


      • #4
        Re:Inconsistent behavior of the transformer

        There're some differences with data retrieved from different JDBC drivers.

        You can view the exact XML retrived from the DB in the dashboard: select a message, and chech the "raw" tab: you will see a XML with the names of the fields and the data retrieved from the db. If you're not sure post the XML and we'll try to help you.


        • #5
          Re:Inconsistent behavior of the transformer

          I am using MySQL. Here is my select sql query in the Database Reader:

          select pm.mrd_number as mrd_number, pm.firstname as firstname, as sex, lm.language_name from patient_master pm
          LEFT JOIN language_master lm ON ( = pm.language_id)

          The source xml generated by Mirth is:

          <?xml version="1.0" encoding="UTF-8"?>

          Here is the Transformed Message. In my mapping, I have mapped firstname, mrd number and sex columns. But none of the mappings are available in the corresponding Transformed message fields. I am using the alias names of the sql in my mappings and everything worked fine until i introduced the lm.language_name in my select column list.

          <?xml version="1.0" encoding="UTF-8"?>
          <MSH.3.1>Regional MPI</MSH.3.1>
          <MSH.5.1>Master MPI</MSH.5.1>
          <MSH.6.1>Alpha Hospital</MSH.6.1>
          <EVN.5.9>Regional MPI&amp;2.16.840.1.113883.19.201&amp;ISO</EVN.5.9>
          <PID.3.4>NationalPN&amp;2.16.840.1.113883.19.3&amp ;ISO</PID.3.4>
          <PID.3.8>CarefulCareClinic&amp;2.16.840.1.113883.1 9.2.400566&amp;ISO</PID.3.8>
          <PID.3.12>GoodmanGP&amp;2.16.840.1.113883.19.2.450 998&amp;ISO</PID.3.12>
          <PID.11.1>Randomroad 23a&amp;Randomroad&amp;23a</PID.11.1>
          <PID.13.1>555 3542557</PID.13.1>
          <PID.13.3>PH~555 3542558</PID.13.3>
          <PID.14.1>555 5557865</PID.14.1>


          • #6
            Re:Inconsistent behavior of the transformer

            As you get the next XML as input:

            <?xml version="1.0" encoding="UTF-8"?>
            You can access to the value of each field the next way:



            • #7
              Re:Inconsistent behavior of the transformer

              Thank you very much. It worked fine.