If an incoming message has a repeatable message element and all its values are to be processed by the database, the corresponding statement execution is iterated. To do this, all the repeatable elements should be specified and all the statements should be properly nested. For each statement type, you have

<statement name="..." iterate="...">

One repeatable element is specified by the iterate attribute. The statement is executed once for each value of the element. For example, an XML message with three repetitions of DischargeEvent.Diagnosis is as follows:

 <DischargeEvent>
 ...
	<Diagnosis>
		<diagnosis_code value="code"/>
		<diagnosis_description value="diagnosis"/>
		<diagnosis_codingSystem value="system1"/>
		<diagnosis_isPrimary value="Y"/>
	</Diagnosis>
	<Diagnosis>
		<diagnosis_code value="code"/>
		<diagnosis_description value="diagnosis2"/>
		<diagnosis_codingSystem value="system2"/>
		<diagnosis_isPrimary value="N"/>
	</Diagnosis>
	<Diagnosis>
		<diagnosis_code value="code"/>
		<diagnosis_description value="diagnosis3"/>
		<diagnosis_codingSystem value="system3"/>
		<diagnosis_isPrimary value="N"/>
	</Diagnosis>
 ...
</DischargeEvent>

If you wish to insert all element values into a table called Diagnosis, then the configuration XML should include a statement similar to the following statement:

<statement name="Diagnosis" iterate="DischargeEvent.Diagnosis">
	<sql> 
		insert into Diagnosis(code, description, codingSystem, isPrimary) 
		values (@DischargeEvent.Diagnosis.diagnosis_code.value, 
		@DischargeEvent.Diagnosis.diagnosis_description.value, 
		@DischargeEvent.Diagnosis.diagnosis_codingSystem.value, 
		@DischargeEvent.Diagnosis.diagnosis_isPrimary.value) 
	</sql> 
</statement>

The Diagnosis statement is executed three times, resulting in three rows being inserted into the table.