// This module is included in the following assemblies:
// as_mapping-data.adoc

[id='mapping-between-collections-and-non-collections_{context}']
= About mapping between collections and non-collections

In the data mapper *Source* and *Target* panels: 

* image:images/integrating-applications/collection-icon.png[Collection icon]
indicates a collection. If the collection contains one primitive type, 
you can map directly from or to that collection. If the collection 
contains two or more different types, the data mapper 
displays the collection’s child fields and you can map to or from the 
collection’s fields.  

* image:images/integrating-applications/folder.png[Folder icon] indicates an 
expandable container that is a complex type. A complex type contains 
multiple fields of different types. A field in a complex type can be a 
type that is a collection, such as an array. You cannot map a complex 
type container itself. You can map only the fields that are in the complex type. 

To toggle the display of data types, such as `*(COMPLEX)*`, 
`*STRING*`, `*INTEGER*`, click image:images/integrating-applications/show-types-icon.png[Show/hide types icon].

.Collection to non-collection (many-to-one) mapping

When you map from a collection field to a non-collection field, the data mapper 
recognizes a many-to-one mapping. The default behavior is that the data mapper 
applies the *Concatenate* transformation to the source collection or 
source collection field. The default delimiter is a space. For example, 
consider this source collection:

** In the first element, the value in the *city* field
is *Boston*. 
** In the second element, the value in the *city* field 
is *Paris*.
** In the third element, the value in the *city* field 
is *Tokyo*. 

During execution, the data mapper populates the target field with 

`Boston Paris Tokyo`

You can change this default behavior by applying a different transformation. 
For example, to map only from the element that you choose, apply the *Item At* 
transformation to the source and specify an index. To map the value that is 
in the first element in the source collection, specify `0` for the index.

If a source collection contains fields that you do not map, 
those fields are still available to subsequent steps that
are in the flow. 

.Non-collection to collection (one-to-many) mapping

When you map from a non-collection source field to a target collection 
or to a target field that is in a collection element, the data mapper 
recognizes a one-to-many mapping. The default behavior is that the data 
mapper applies the *Split* transformation by using whitespace as the delimiter 
and splitting the source value into multiple values. During execution, 
the data mapper inserts each split value into its own element in the target 
collection. For example, if the source field is split into 4 values 
then the target collection has 4 elements. 

For example, consider a non-collection, `cities` source field that contains:

`Boston Paris Tokyo`

You can map this source field to a target collection or to a 
target field that is in a collection. 
During execution, the data mapper splits the value of the 
*cities* field at the space delimiter. The result is a 
collection that contains three elements. In the first 
element, the value of the *city* field is `Boston`. In the 
second element, the value of the *city* field is `Paris`. 
In the third element, the value of the *city* field is `Tokyo`. 

.Additional resources
* link:{LinkSyndesisIntegrationGuide}#about-transformations-on-multiple-source-values_map[About transformations on multiple source values before mapping to one target field]
* link:{LinkSyndesisIntegrationGuide}#combine-multiple-source-fields-into-one-target-field_map[Combining multiple source fields into one target field]
* link:{LinkSyndesisIntegrationGuide}#separate-one-source-field-into-multiple-target-fields_map[Separating one source field into multiple target fields]
