Concatenate all the records of a field in Data Mapping

Requirement: I have a scenario where I want to concatenate all the records of a Source field and map it to context variables in the target context schema in Data Mapping.


Resolution: To achieve your requirement, kindly follow the following steps:-

1. Create a Custom XSL before (CXB) on the context variable at the target schema and copy the below line of codes in it.

<xsl:for-each select="Root/Record"> // Xpath of the Source schema
<xsl:variable name="varGetValue" select="saxonJavaMappingTransformation:getVariable($_class,&apos;TargetContextSchema&apos;,&apos;&apos;)"/>
<xsl:variable name="varConcat" select="concat($varGetValue,NAME)"/> //define the source field
<xsl:variable name="varSetValue" select="saxonJavaMappingTransformation:setVariable($_class,&apos;TargetContextSchema&apos;,$varConcat)"/>
<xsl:value-of select="$varSetValue"/>


2. Now, create a local variable lets say "varGet" on the same target field and define its value as ' get-context( 'TargetContextSchema', '') '.

3. Map the local variable in the textual rule of the context variable.


Have more questions? Submit a request


Article is closed for comments.