连续选择唯一值并在BizTalk Map中添加相应数据 [英] Choosing Unique Values Consecutively and Adding Respective Data In BizTalk Map

查看:50
本文介绍了连续选择唯一值并在BizTalk Map中添加相应数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我对这个BizTalk Server 2010及其在visual studio中的映射非常陌生。


我正面临着通过连续检查并添加相应的其他数据来发送唯一数据时出现问题。


我的输入:



< ns0:Root xmlns:ns0 =" http://ConsecutiveCheck.Input">

 <输入>

  < PO>

   < PONum> PO123< / PONum> 

  < / PO>

  < SKU>

   < SKUNum> SKU123< / SKUNum> 

   < Qty> 100< / Qty> 

   < Desc> Desc_1< /" 

  < / SKU>

  < SKU>

   < SKUNum> SKU123< / SKUNum> 

   < Qty> 200< / Qty> 

   < Desc&Desc; Desc_2< /" 

  < / SKU>

  < SKU>

   < SKUNum> SKU125< / SKUNum> 

   < Qty> 300< / Qty> 

   < Desc&Desc; Desc_3< / Desc> 

  < / SKU>

  < SKU>

   < SKUNum> SKU125< / SKUNum> 

   < Qty> 400< / Qty> 

   < Desc&Desc; Desc_4< / Desc> 

  < / SKU>

  < SKU>

   < SKUNum> SKU123< / SKUNum> 

   < Qty> 500< / Qty> 

   < Desc&Desc; Desc_5< / Desc> 

  < / SKU>

  < SKU>

   < SKUNum> SKU125< / SKUNum> 

   < Qty> 600< / Qty> 

   < Desc&Desc; Desc_6< / Desc> 

  < / SKU>

 < /输入>

< / ns0:Root>




预期输出:


< ns0:Root xmlns:ns0 =" http://ConsecutiveCheck.Input" ;>
$
 <输出>

  < PO>

   < PONum> PO123< / PONum> 

  < / PO>


  < SKU>

   < SKUNum> SKU123< / SKUNum> 

  &NBSP;<数量> 300℃; /数量>   //连续检查(向下看)SKUNum数量已添加100 + 200

   < Desc >> Desc_1 Desc_2< /'  //连续检查SKUNUM Desc已与空格连接

  < / SKU>


  < SKU>

   < SKUNum> SKU125< / SKUNum> 

   < Qty> 700< / Qty>   //连续检查SKUNUM数量已添加300 + 400

   < Desc&Desc; Desc_3 Desc_4< / Desc;  //连续检查SKUNum Desc已与空格连接

  < / SKU>


< SKU>

  &NBSP;< SKUNum> SKU123< / SKUNum> //按原样发送,与SKUNum不同为
   < Qty> 500< / Qty> 

   < Desc&Desc; Desc_5< / Desc> 

  < / SKU>


< SKU>

  &NBSP;< SKUNum> SKU125< / SKUNum> //发送原样,因为下一个没有数据或检查下一个索引是否为空
   < Qty> 600< / Qty> 

   < Desc&Desc; Desc_6< / Desc> 

  < / SKU>


 < / output>

< / ns0:Root>


这是一种情况。


添加到此我有多个< Input>循环,所以在相应的< PO>下循环我想执行上述操作。


需要映射链接/ Functoid或C#脚本编码。


任何提示或逻辑都非常有帮助。迫切需要。


谢谢&最好的问候

解决方案

嗨Siddharth,


以上给出的样本和要求,遵循XSLT将起作用。此XSLT还处理多个< Input>您在需求中指定的输入模式中的循环/记录。


您可能需要更改命名空间以适合您的命名空间。

<?xml version =" 1.0"编码= QUOT; UTF-16"?> 
< xsl:stylesheet xmlns:xsl =" http://www.w3.org/1999/XSL/Transform"的xmlns:msxsl = QUOT;瓮:架构 - 微软-COM:XSLT"的xmlns:VAR =" HTTP://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes =" msxsl var"版本= QUOT; 1.0"的xmlns:NS0 = QUOT; HTTP://ConsecutiveCheck.Input">
< xsl:output omit-xml-declaration =" yes"方法= QUOT; XML"版本= QUOT; 1.0" />
< xsl:template match =" /">
< xsl:apply-templates select =" / ns0:Root" />
< / xsl:template>
< xsl:template match =" / ns0:Root">
< ns0:Root>
< xsl:for-each select =" Input">

< xsl:variable name =" posInput"选择= QUOT;位置()" />
<输出>
< PO>
< PONum>
< xsl:value-of select =" PO / PONum / text()" />
< / PONum>
< / PO>
< xsl:for-each select =" SKU">

< xsl:variable name =" countOfSKU"选择= QUOT;计数(/ NS0:根/输入

posInput] / SKU)" />
< xsl:variable name =" posOfSKU"选择= QUOT;位置()" />
< xsl:if test =" / ns0:Root / Input


posInput] / SKU


Hi,

I am very new to this BizTalk Server 2010 and its mapping in visual studio.

I am facing an issue while sending the unique data by consecutive checking and adding the respective other data.

My input:

<ns0:Root xmlns:ns0="http://ConsecutiveCheck.Input">
 <Input>
  <PO>
   <PONum>PO123</PONum> 
  </PO>
  <SKU>
   <SKUNum>SKU123</SKUNum> 
   <Qty>100</Qty> 
   <Desc>Desc_1</Desc> 
  </SKU>
  <SKU>
   <SKUNum>SKU123</SKUNum> 
   <Qty>200</Qty> 
   <Desc>Desc_2</Desc> 
  </SKU>
  <SKU>
   <SKUNum>SKU125</SKUNum> 
   <Qty>300</Qty> 
   <Desc>Desc_3</Desc> 
  </SKU>
  <SKU>
   <SKUNum>SKU125</SKUNum> 
   <Qty>400</Qty> 
   <Desc>Desc_4</Desc> 
  </SKU>
  <SKU>
   <SKUNum>SKU123</SKUNum> 
   <Qty>500</Qty> 
   <Desc>Desc_5</Desc> 
  </SKU>
  <SKU>
   <SKUNum>SKU125</SKUNum> 
   <Qty>600</Qty> 
   <Desc>Desc_6</Desc> 
  </SKU>
 </Input>
</ns0:Root>

Expected Output:

<ns0:Root xmlns:ns0="http://ConsecutiveCheck.Input">
 <Output>
  <PO>
   <PONum>PO123</PONum> 
  </PO>

  <SKU>
   <SKUNum>SKU123</SKUNum> 
   <Qty>300</Qty>  //consecutively checking (looking to next) the SKUNum Qty has been added 100+200
   <Desc>Desc_1 Desc_2</Desc> //consecutively checking the SKUNum Desc has been concatenated with space
  </SKU>

  <SKU>
   <SKUNum>SKU125</SKUNum> 
   <Qty>700</Qty>  //consecutively checking the SKUNum Qty has been added 300+400
   <Desc>Desc_3 Desc_4</Desc> //consecutively checking the SKUNum Desc has been concatenated with space
  </SKU>

<SKU>
   <SKUNum>SKU123</SKUNum> //send as it is as next is different with SKUNum
   <Qty>500</Qty> 
   <Desc>Desc_5</Desc> 
  </SKU>

<SKU>
   <SKUNum>SKU125</SKUNum> //send as it is as next has no data or checking with next index is null
   <Qty>600</Qty> 
   <Desc>Desc_6</Desc> 
  </SKU>

 </Output>
</ns0:Root>

This is one scenario.

Added to this I have multiple <Input> loop, so under respective <PO> loop I want to perform the above operation.

Need Mapping Link/Functoids or C# Script Coding for this.

Any hint or logic is greatly helpful. Need Urgently.

Thanks & Best Regards

解决方案

Hi Siddharth,

For the above given sample and the requirement, following XSLT will work. This XSLT also handles multiple <Input> loop/record in the input schema as you have specified in your requirement.

You can need to change the namespace to suit yours.

<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var" version="1.0" xmlns:ns0="http://ConsecutiveCheck.Input">
  <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
  <xsl:template match="/">
    <xsl:apply-templates select="/ns0:Root" />
  </xsl:template>
  <xsl:template match="/ns0:Root">
    <ns0:Root>
      <xsl:for-each select="Input">

        <xsl:variable name="posInput" select="position()" />
        <Output>
        <PO>
          <PONum>
            <xsl:value-of select="PO/PONum/text()" />
          </PONum>
        </PO>      
          <xsl:for-each select="SKU">

          <xsl:variable name="countOfSKU" select="count(/ns0:Root/Input


posInput]/SKU)" /> <xsl:variable name="posOfSKU" select="position()" /> <xsl:if test="/ns0:Root/Input


posInput]/SKU


这篇关于连续选择唯一值并在BizTalk Map中添加相应数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆