Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   Creating repeat segment (http://www.mirthcorp.com/community/forums/showthread.php?t=15576)

jarlrmai 08-11-2015 05:08 AM

Creating repeat segment
I have this code


logger.info("No PV1.17 copy PV1.9");

tmp['PV1']['PV1.17'] = msg['PV1']['PV1.9']; //duplicate-strip

var newPV17 = new XML('<PV1.17/>');                               
newPV17['PV1.17.1'] = globalMap.get('consultantcodeMap').get(msg['PV1']['PV1.9']['PV1.9.1'].toString().substr(0,8));
newPV17['PV1.17.9'] = "TCPAS";
tmp['PV1'][0]['PV1.17'][1] += newPV17;

My expectation is that it should clone PV1.9 over the top of PV1.17 then add a second PV1.17 segment with the 2 fields from the array lookup and the string but it just seems to add the XML at the end of the PV1 segment to PV1.60 which isnt even in the template.

Any ideas?

jarlrmai 08-12-2015 02:01 AM

Okay I figured out a bit more

tmp['PV1']['PV1.17'] = msg['PV1']['PV1.9']; //duplicate-strip

This just replaces the section so 9 just ends up in the XML. but in the same position that 17 was.

What I need to do is take each field in PV1.19 and make it into a PV1.17 section

What's happening at the moment is:



All times are GMT -8. The time now is 07:29 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation