Record is not being mapped with BizTalk map Logical OR Operator

343 views Asked by At

I am stuck in the issue .

I have two Input Fields

1) External Notes

2) Internal Notes

I want to map them to the destination node "Comments"

IF

External Notes is coming (do mapping)

Internal Notes is coming (do mapping)

Both filds are coming ( do mapping)

No field is coming ( Don't Map)

I have performed following tasks :

1) Check the logical existance if the node is coming.

2) used Equal fuctoid to confirm if the value is true . Logical existance = true - > pass true to OR Operator

3) Logical OR which performs Logical OR to both Fields .

4) value mapping to set the value .

enter image description here

This logic is working fine for the following scenarios :

a) InternalNotes come ( mapped successfully)

b) Both values (inter & exter ) comes (Mapped Successfully)

c) Extrnal Notes Comes ( Not Mapped)

I have tried alot but did not get anything why this External Value is not being mapped .

Please help me .

Thanks


Following should be the output for below Input messages :

INPUT 1:

<InternalNotes>
<Value>Internal notes value</Value>
</InternalNotes>

OUTPUT 1:

<Comments>
<Name>Comments</Name>
<Operation>Append</Operation>
<Value>Internal notes value</Value>
</Comments>

INPUT 2:

<ExternalNotes>
<Value>External notes value</Value>
</ExternalNotes>

OUTPUT 2:

<Comments>
<Name>Comments</Name>
<Operation>Append</Operation>
<Value>External notes value</Value>
</Comments>

INPUT 3:

  <ExternalNotes>
    <Value>External notes value</Value>
    </ExternalNotes>
  <InternalNotes>
    <Value>Internal notes value</Value>
    </InternalNotes>

OUTPUT 3:

 <Comments>
    <Name>Comments</Name>
    <Operation>Append</Operation>
    <Value>External notes value .
           Internal Notes value
    </Value>
   </Comments>
2

There are 2 answers

0
StuartLC On BEST ANSWER

This is a straightforward mapping if you use xslt - look here to convert your map to xslt.

For example:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

   <xsl:output method="xml" indent="yes"/>

   <xsl:template match="/xml">
      <xsl:if test="InternalNotes or ExternalNotes">
         <!-- . and newline delimiter if both elements present, else none -->
         <xsl:variable name="delimiter">
            <xsl:if test="InternalNotes and ExternalNotes">.&#10;</xsl:if>
         </xsl:variable>
         <Comments>
            <Name>Comments</Name>
            <Operation>Append</Operation>
            <Value>
               <xsl:value-of select="concat(InternalNotes/Value/text(), 
                    $delimiter, ExternalNotes/Value/text())"/>
            </Value>
         </Comments>
      </xsl:if>
   </xsl:template>
</xsl:stylesheet>

This converts the following:

<xml>
   <ExternalNotes>
      <Value>External notes value</Value>
   </ExternalNotes>
   <InternalNotes>
      <Value>Internal notes value</Value>
   </InternalNotes>
</xml>

To this:

<?xml version="1.0" encoding="utf-8"?>
<Comments>
  <Name>Comments</Name>
  <Operation>Append</Operation>
  <Value>Internal notes value.
External notes value</Value>
</Comments>

You haven't mentioned what the output should look like with no matches, but you'll obviously at least need a root element. More elegant xslt solutions are possible, I'm sure, but you get the idea :)

1
kletnoe On

Looks like your map is valid, try to remove Equality functoids, just map Existance to LogicalOr directly.

P.s. Please provide your input example and expected output if didn't I got your idea.