Announcement

Collapse
No announcement yet.

how to get the mapp using dbreader v1.4

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

  • how to get the mapp using dbreader v1.4

    I have a channel which reads xml from a file and transforms to hl7 using javascript like this

    tmp['PID']['PID.5']['PID.5.1'] = msg['Patient']['lastName'].toString();
    tmp['PID']['PID.5']['PID.5.2'] = msg['Patient']['firstName'].toString();

    This works fine for a filereader but when I switch to a database reader using this SQL

    select message from messages where processed = 'U'

    I lose the ability to map and I lose my template. My Incoming Data template is replaced with this

    <?xml version="1.0" encoding="UTF-8"?>
    <result>
    <message>value</message>
    </result>

    and the logger output shows the same wrapper xml

    <result><message><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
    <IMessage><Patient>...blah...</Patient></IMessage>]]></message></result>

    how to make it the same as a file reader? Perhaps there is a function I can apply to msg[&#039;message&#039;].toString() but I dont see how I can get my mapper to stick?

  • #2
    Re: how to get the mapp using dbreader v1.4

    You can get to the contents of the message by doing the following in your first step (Javascript Type):

    Code:
    msg = new XML(msg[&#039;message&#039;].toString());
    By doing that, msg will now work as you specified (msg[&#039;Patient&#039;] etc). It tells Mirth to pull the value out of the "message" value and convert it to an XML object.

    As far as your mappings, Mirth will overwrite your inbound data template with the value you are getting from the database (maybe this should be configurable?? If you desire this, please add it to the Jira -> www.mirthproject.org/jira). You can temporarily replace the auto-generated XML in the incoming data tab with your sample XML to perform your mappings. Just make sure your javascript step to set msg comes before your mapper steps.

    Hope that helps!
    -Chris
    Chris Lang

    Comment


    • #3
      Re: how to get the mapp using dbreader v1.4

      That did the trick. Yes, I do want Mirth to use the xml from the database - its more of a usability issue. Since I am constantly back and forth between saving the channel and deploying to test it makes for a long cycle to have to repaste the XML each time (added onto the several mouse clicks to deploy the channel).

      I can add a jira for the usability enhancement.

      Comment


      • #4
        Re: how to get the mapp using dbreader v1.4

        That would be great, thanks!
        Chris Lang

        Comment

        Working...
        X
        😀
        🥰
        🤢
        😎
        😡
        👍
        👎