NextGen Knowledge Center

Iterating Over Repeating Fields

To iterate over repeating fields, check the Handle Repetitions property. First, use the XML object’s length() method to get the number of repetitions to iterate over: var reps = msg ['PV1]['PV1.7'].length();

Then, use a for each loop to iterate over repetitions:

for each (attendingDr in msg['PV1']['PV1.7']) {
      lastName = attendingDr['PV1.7.2'].toString();
}

Note that although JavaScript can be used to iterate through repeating fields, you may find it easier to use the instead.