No announcement yet.

How to access to the database fields

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to access to the database fields

    Hi to all!

    Maybe it is a silly question, but I'm going crazy.

    I've created a channel that reads from a database and writes to a text file.
    The problem is that I don't know how to access to the fields that i want.

    when I put ${message.encodedData} in the template i get all the result of the query in xml format.

    But I only want to put the patient name in the text file. How can I access the fields, I've tried to put msg['patient'], but it didn't work.

    Thank you!

  • #2
    Re:How to access to the database fields

    Under Destinations, Edit Transformer.

    Map the incoming field (connector map) you want to print to the text file, say NAME maps to msg['PID']['PID.5']['PID.5.1'].toString() or some such.

    Exit Back to Channels.

    You should now have the variable available under "DESTINATIONS MAPPINGS".


    • #3
      Re:How to access to the database fields

      Thank you very much Jhon, I didn't see the edit transformer button. ;-)


      • #4
        Re:How to access to the database fields

        hope you are using mirth 1.4.0/1.5.0/1.6.0/1.6.1. here you specify the SELECT query in the source tab. The variable will be shown in the variable windows of the same page. you have edit transformer in source tab, there you need to map this variable (query variable) to one userdefined variable (preferrebly channel map). go to destination --> edit transformer and then paste a sample HL7 template in the Outgoing tab. create new transform (message builder) and then map the corresponding field to the variable described in the source. and make sure in the template its message.encodedData.
        its easy and simple.