Iterate Over 1 Segment Containing Multiple Items

lundi 23 février 2015

I am needing to change multiple repeating dates in a single segment (see below) I am not sure how to achieve this. I have have been able to do this when the segment contains a single value (also below) but not when the segment contains multiple values for each order.



HL7 Message:


Code:



PV1|1|0|1111||||^Test^Test^T|||||||||||||V02^20150202121200~V02^20150202121200~V02^20150202121200~V02^20150202121200|||||||


What I will need to do is change the V02^20150202121200 to keep only the first 8 numerals ie: V02^[B]20150202 for each repeating V02 in that single segment.



Here is the code to do it when the segment only has one variable:




Code:



var origDate = msg['PV1']['PV1.20']['PV1.20.2'].toString();

var newDate = origDate.substring(0,8);



msg['PV1']['PV1.20']['PV1.20.2'] = newDate;








Iterate Over 1 Segment Containing Multiple Items

0 commentaires:

Enregistrer un commentaire