web stats
Iterate over Repeating Fields - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 02-03-2014, 12:41 PM
TSmithTRA TSmithTRA is offline
OBX.2 Kenobi
Join Date: Nov 2009
Location: Winston-Salem, NC
Posts: 79
TSmithTRA is on a distinguished road
Lightbulb Iterate over Repeating Fields

To iterate over repeating fields make sure Parse Field Repetitions is checked in connector properties.

Code to iterate over field

var Accession = new Array()
i = 0
for each (fld in msg['ORC']['ORC.2'])
Accession[i] = fld['ORC.2.1'].toString();
var NumInArray=Accession.length;
var AccArray=Accession.toString();

fld is the variable that holds the preceding message string (['ORC']['ORC.2'][0])

this will work for any field that is repeated simply substitute msg['ORC']['ORC.2'] with the repeating field you want to iterate through

the above code loads repeating accession numbers into an Array that can be looped through later as needed.
Tom Smith
IT Director
Triad Radiology Associates
Reply With Quote

iterate repeating fields, parse repeating fields, repeating fields

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 08:55 PM.

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