Filling Text Fields

Line 6 of Sample 14 refers to a plain standard text field. The corresponding mapping might look something like this:

<target-entity name="Applicant">
  <map-attribute from="ssn" to="SSN"/>
</target-entity>

Line 5 is somewhat different. The type is marked as "append". This means that the same text field can be written to multiple times and each time the Mapping Engine writes to the text field, the result is appended to the current value of the text field rather than overwriting it. Each time an append occurs, the new data is separated from the old data by the append-separator, in this case a single space character. Taking a mapping file like that shown in Sample 16, and combining it with the Mapping Configuration shown in Sample 14 will result in the field Applicant.Name being filled with the Applicants first name, middle initial and surname e.g. "Pat A Kayek".

<target-entity name="Applicant">
  <map-attribute from="firstName" to="Name"/>
  <map-attribute from="middleInitial" to="Name"/>
  <map-attribute from="lastName" to="Name"/>
</target-entity>

Appending text fields are also useful for creating a comma separated list of items. Consider a field that asks the client to provide a list of people in their household who are pregnant. An extract from the mapping XML might typically look something like this:

<condition expression="Person.isPregnant == true">
   <target-entity name="Pregnancy">
     <map-attribute from="firstName" to="Pregnancy"/>
     <set-attribute name="HasPregnancies" value="Yes"/>
   </target-entity>
 </condition>

The corresponding Mapping Configuration is shown in Figure 18. Each time the Mapping Engine processes a Person in the household for which the isPregnant indicator is set to true, the first name of that person is appended to the Pregnancy.Pregnancies field.

<section name="Pregnancy">
  <field name="Pregnancies" type="button-checkbox"/>
  <field name="Pregnancy" type="append" append-separator=", "/>
</section>