Repeating Fields Causing Parsing Problems for PV1 Segment

vendredi 16 janvier 2015

I am attempting to map the entire ADT Location out of the PV1.3 segment and added the following map:



channelMap.put('PV1_FullLocation',msg['PV1']['PV1.3'].toString());



However, the mapping comes out looking like this with the actual data sandwiched between the respective field identifiers:



<PV1.3><PV1.3.1>BAR6</PV1.3.1><PV1.3.2>068</PV1.3.3>02</PV1.3.3></PV1.3>



I believe this is due to these fields being repeating fields. I was attempting to modify this using some code that we used previously with some other repeating fields that were parsing in the same manner:



for (i=0;i<msg.children().length();i++) { //Goes through the message

var node = msg.children()[i];

if (node.name() == 'IN1') { //checks if it is IN1

if (node['IN1.16'].length()>1) { //if there is more than one node in IN1.16, ie one or more tildes

msg.children()[i]['IN1.16'] = node['IN1.16'][0]; //have IN1.16 be set to the first node, ie removing everything after the first tilde

}

if (node['IN1.3'].length()>1) {

msg.children()[i]['IN1.3'] = node['IN1.3'][0];



Does anyone have any suggestions on updating the channel map so it doesn't pick up the field headers in the parsed message?



Thank you.





Repeating Fields Causing Parsing Problems for PV1 Segment

0 commentaires:

Enregistrer un commentaire