Skip to main content Skip to complementary content

Generating and configuring an AgConcat expression

Last updated: 8/27/2026

Talend Data Mapper can automatically generate an AgConcat expression to deal with incompatible loops.

About this task

This example uses the following XML sample as input:
<root>
	<loopA>
		<A>a1</A>
		<loopB>
			<B>b11</B>
		</loopB>
		<loopB>
			<B>b12</B>
		</loopB>
		<loopC>
			<C>c11</C>
		</loopC>
		<loopC>
			<C>c12</C>
		</loopC>
	</loopA>
	<loopA>
		<A>a2</A>
		<loopB>
			<B>b21</B>
		</loopB>
		<loopB>
			<B>b22</B>
		</loopB>
		<loopC>
			<C>c21</C>
		</loopC>
		<loopC>
			<C>c22</C>
		</loopC>
	</loopA>
</root>
The XML output structure is defined as follows:
root
	row (0:*)
		A
		B
		C1
		C2

Procedure

  1. Create a map and add your input and output structure.

    Example

    Example of an input and output structure.
  2. Place the input A element to the output A element.
    A looping expression is automatically created on the output row element.
    Creation of a looping expression.
  3. Place the input B element to the output B element.
    This action creates a conflict, the looping context of the input B element is not compatible with the current output looping context.
  4. Select Generate AgConcat value expression on out$/root/row/B and click OK.
    Change Loop Specification or Generate AgConcat dialog box.
    An AgConcat function is automatically added to the output B element.
  5. Place the input C element to the output C1 element, then select Generate AgConcat value expression on out$/root/row/C1 and click OK.
  6. Place a SingleIndex function on the Filter argument of the AgConcat function.
    This allows you to specify that the output C1 element should only return the first value of the input C element.
  7. Place the input C element to the output C2 element, then select Generate AgConcat value expression on out$/root/row/C2 and click OK
    Because the sibling C1 element contains a filter, a matching filter is automatically added to C2 so that it only returns the second value of the input C element.
    Creation of a matching filter.

Results

The map is configured, you can use the Test Run option to see the result. In this example, it looks like this:
<root>
  <row>
    <A>a1</A>
    <B>b11b12</B>
    <C1>c11</C1>
    <C2>c12</C2>
  </row>
  <row>
    <A>a2</A>
    <B>b21b22</B>
    <C1>c21</C1>
    <C2>c22</C2>
  </row>
</root>

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!