I have a need to remove all of the subfields past the 9th one in the OBR-28 segment.
Tried this but it doesn't work. It says the length of OBR-28 == 1 but there are move subfields that that
message contains 1 obr :
OBR|1|725885585^HNAM_ORDERID|850612^EPIC_Filler_Or der_Id|006127^Lytes|||20210331101552|||||||2021033 1101500|&Blood|||||000002021090000005^HNA_ACCN~111 86305^HNA_ACCNID||20210331101710|||C||1^^^20210331 101300^^S|1740387760^VOINESCU^CATALINA^GENTIANA^^M D^MD^^NPI^Personnel^^^External Identifier
I need to remove everything past the OBR-28.9 (after 'NPI')
Tried this but it doesn't work. It says the length of OBR-28 == 1 but there are move subfields that that
Code:
logger.info('obr ' + msg['OBR'].length().toString()); logger.info('28 length: ' + msg['OBR'][0]['OBR.28'].length().toString()); for (var i = msg['OBR'].length()-1;i>0;i++) { for (var j = msg.children()[i]['OBR.28'].length() -1; j>9;j--) { delete msg.children()[i]['OBR.28'][j]; } }
OBR|1|725885585^HNAM_ORDERID|850612^EPIC_Filler_Or der_Id|006127^Lytes|||20210331101552|||||||2021033 1101500|&Blood|||||000002021090000005^HNA_ACCN~111 86305^HNA_ACCNID||20210331101710|||C||1^^^20210331 101300^^S|1740387760^VOINESCU^CATALINA^GENTIANA^^M D^MD^^NPI^Personnel^^^External Identifier
I need to remove everything past the OBR-28.9 (after 'NPI')
Comment