Sidebar

How do you force the order of segments? [closed]

0 votes
358 views
asked Nov 2, 2015 by (600 points)
closed Nov 2, 2015 by
Hello,

  I have 5 transforms (one for MSH, EVN, PD1, PV1 and then a conditional PV1 mapping)

The problem is the output ends up as

MSH

EVN

PID

PV1

PD1

 

But I need

MSH

EVN

PID

PD1

PV1

 

(i.e. PD1 and PV1 swapped round).  The mappings are called in the order I would expect to the output to be, but this isn't happening.
closed with the note: Ben answered

1 Answer

0 votes

Two solutions (these answers are from Ben! not me)

 


var pd1Seg = message.getNode('PD1');

 

message.removeAllNodes('PD1');

message.addChildAfter('PV1', 'PD1', pd1Seg);

var newMessage = message.getNode('MSH[group!=PD1]') + '\n';

newMessage += message.getNode('PV1') + '\n';
 
newMessage += message.getNode('PD1') + '\n';
message.setNode('/', newMessage);

var pd1Seg = message.getNode('PD1');

message.removeAllNodes('PD1');
 
message.addChildAfter('PV1', 'PD1', pd1Seg);
 
answered Nov 2, 2015 by (600 points)
...