Announcement

Collapse
No announcement yet.

Transformer : Message builder

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

  • Transformer : Message builder

    Hello Everybody,

    How can we use the transformer message builder ?
    I try to use it to replace a string (for exemple the patient name) I put on the form the conditions :

    message segment : "Change patient name"
    Mapping : msg['PID']['PID.5']['XPN.1']['FN.1']
    Default value : ""
    String replacement : Regular expression : .* Replace with : "toto".

    I always obtain a java exception. That's wrong ? Can you give me one example ?


    Thanks,




  • #2
    Re: Transformer : Message builder

    You need to create JavaScript Transformer step. In the Transformer screen, when you do "Add Step", you see a row with "newVar0" under column "Name" and "Mapper" under column "Type". Double click under "Type" it should show a list box with "Mapper" and "JavaScript" dropdown. Select "JavaScript".

    Here's a sample JavaScript code.
    Code:
    // Get patient SSN with "-" removed
     var tempSSN = "";
    if (pidSegment['PID.19'] != null) {
       tempSSN = pidSegment['PID.19'].toString();
       if (tempSSN.length > 0) {
           tempSSN = tempSSN.replace(/-/g, "");
      }
    }
    For more samples, refer FileRepository and Wiki:

    FileRepository
    http://www.mirthproject.org/index.ph...cman&Itemid=43

    Wiki
    http://www.mirthproject.org/index.ph...wiki&Itemid=44

    Hope it helps!

    Comment

    Working...
    X