No announcement yet.

How do I pull this XML field into a mapped variable

  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I pull this XML field into a mapped variable

    I have an incoming message that is getting parsed into XML like this:


    I want to pull NumberTwo in a transformer and set it to a channel variable.

    Based on previous experience with mirth, I would think that I would do something like...

    Mapping: msg['PID']['PID.3']['PID.3.5']['PID.3.5.2'].toString() but this is throwing an error.

    Can somebody help me out with this simple syntax issue? Thanks!

  • #2
    Assuming your encoding characters are "^~\&", then your field repetition marker is "~", and your subcomponent marker is "&". So to retrieve "NumberTwo" (which is in the first component of the second repetition of PID.3, not the second subcomponent of PID.3.5), you need to check "Parse Field Repetitions" on the inbound protocol (Source Inbound if transforming on the source, Source Outbound if on the destination), and then use the following syntax:

    Note that using that syntax is assuming that there are always at least two repetitions of PID.3. An ECMAError will be thrown if there aren't, so make sure to do proper validation, etc.
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.

    - How do I foo?
    - You just bar.


    • #3