【问题标题】:Record is not being mapped with BizTalk map Logical OR Operator记录未使用 BizTalk 映射逻辑 OR 运算符进行映射
【发布时间】:2013-09-09 10:18:41
【问题描述】:

我陷入了这个问题。

我有两个输入字段

1) 外部注释

2) 内部注释

我想将它们映射到目标节点“评论”

如果

外部笔记来了(做映射)

内部笔记来了(做映射)

两个领域都来了(做映射)

没有字段来(不要映射)

我完成了以下任务:

1) 如果节点来了,检查逻辑存在。

2) 使用 Equal fuctoid 来确认该值是否为 true 。逻辑存在 = true -> 将 true 传递给 OR 运算符

3) 对两个字段执行逻辑或的逻辑或。

4) 值映射来设置值。

此逻辑适用于以下场景:

a) InternalNotes 来了(映射成功)

b) 两个值(inter & exter)都来了(映射成功)

c) 外部注释来了(未映射)

我已经尝试了很多,但没有得到任何为什么这个外部值没有被映射。

请帮帮我。

谢谢


以下应该是以下输入消息的输出:

输入 1:

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

输出 1:

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

输入 2:

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

输出 2:

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

输入 3:

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

输出 3:

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

【问题讨论】:

    标签: biztalk biztalk-2009 biztalk-mapper


    【解决方案1】:

    如果您使用xslt - look here 将您的地图转换为xslt,这是一个简单的映射。

    例如:

    <?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>
    

    这将转换以下内容:

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

    到这里:

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

    你没有提到没有匹配的输出应该是什么样子,但你显然至少需要一个根元素。我敢肯定,更优雅的 xslt 解决方案是可能的,但你明白了 :)

    【讨论】:

      【解决方案2】:

      看起来你的映射是有效的,尝试删除 Equality functoids,直接将 Existance 映射到 LogicalOr。

      附注如果我不明白您的想法,请提供您的输入示例和预期输出。

      【讨论】:

      • 嗨@FCR,我已经添加了输入和输出结构并更新了图像。请调查一下并提供一些解决方案。你的帮助真的很受欢迎。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-01
      • 1970-01-01
      • 2013-08-26
      • 1970-01-01
      • 2012-03-31
      • 1970-01-01
      相关资源
      最近更新 更多