Replacing a Character with Carriage Return (\r) in Data Mapper

Situation: In the following global variable in data mapping, the requirement is to replace the last two character of the above ("~^") with a carriage return ("\r") in order to insert it to the database field having multiple lines.

"varPBPList" that have value "IF CONDITION{ $varPBP1E > 0 } VALUE=[ concat( $varPBP1E , ' - 18-UAHPEOC-001-E~^' ) ]". 

Solution: To replace the character "~^" with a carriage return "\r", follow the given steps:

  1. Write the below line of code on a custom XSL before of "Record" element in your data mapping. 

    <xsl:variable name="nl" select="'&#10;'"/>
    <xsl:variable name = "newline">

    <xsl:value-of select="$nl" disable-output-escaping="no"/>

    </xsl:variable>

    <xsl:variable name="varFinalPBP" select="saxonJavaMapperUtilityClass:replaceAll($varPBPList ,'\~\^' ,$newline)" xmlns:saxonJavaMapperUtilityClass="java:MapperUtilityClass"/>

  2. Now, Map the varFinalPBP to the target node.
Have more questions? Submit a request

0 Comments

Article is closed for comments.