Announcement

Collapse
No announcement yet.

Create repeating sequences in a transformer

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

  • Create repeating sequences in a transformer

    The task at hand is to create a set of repeating patient identifiers at PID3. Trying this is a Source Transformer. Using HL7 v2.3.
    I've searched and found a similar thread

    The desired output is something like this:

    PID|1||PHN^foo~MRN^bar~URN^baz|....etc

    I have tried some iterations like:
    Code:
    msg['PID']['PID.3'][0]['PID.3.1'] = "PHN";
    msg['PID']['PID.3'][0]['PID.3.2'] = "foo";
    
    msg['PID']['PID.3'][1]['PID.3.1'] = "MRN";
    msg['PID']['PID.3'][1]['PID.3.2'] = "bar";
    That got me this err message:
    TypeError: Cannot set property "PID.3.1" of undefined to "MRN"
    It sounds like it's describing the index [1] as undefined. I am wondering how I can programatically add a repeater?

    The message template on the Source Transformer is set to 'Handle Repetitions".

    The repeater is the one I can't yet wrap my head around. Can anyone help me find the right syntax for creating repeated values within a sequence?
    Last edited by Philoushka; 04-27-2009, 08:48 AM.

  • #2
    However inelegant, this is how I have managed to achieve my own desired results.

    Code:
    msg['PID']['PID.3']="PHN^" + "foo";
    msg['PID']['PID.3']+="~MRN^" + "bar";
    msg['PID']['PID.3']+="~URN^" + "baz";
    Does anyone have any better ideas than string concatenation here? I'd prefer to use the functionality of Mirth.

    Does anyone have any better ideas on how to programatically create repeating values within a sequence?
    Last edited by Philoushka; 04-27-2009, 09:17 AM.

    Comment

    Working...
    X