Biztalk Map Logic

Hi,
I have the Biztalk Map logic as shown in figure
Discount Step and Loyalty both are repeatitive node structures
Sample Input Xml is as shown below
<DiscountStepList>
 <DiscountStep>
  <NumberOfTrips>35</NumberOfTrips>
  <Percentage>1113</Percentage>
  </DiscountStep>
 <DiscountStep>
  <NumberOfTrips>5</NumberOfTrips>
  <Percentage>7732</Percentage>
  </DiscountStep>
 <DiscountStep>
  <NumberOfTrips>30</NumberOfTrips>
  <Percentage>8280</Percentage>
  </DiscountStep>
   </DiscountStepList>
the logic to get the o/p will be
For Childe Element MIntrip:
in the first iteration Mintrip=1 and in Secoond iteration Mintrip=Last elememnt Maxtrips+1
For CHild Element Maxtrips:
In the first Iteration Maxtrips="NumberOfTrips" and in Second iteration current element MintripNum  + NumberOfTrips.
The o/p for the above input example will be like
<ns0:Loyalites xmlns:ns0="http://BizTalk_Server_Project7.Schemdfa1">
  <Loaylty>
    <MinTrip>1</MinTrip>
    <MaxTrips>35</MaxTrips>
  </Loaylty>
<Loaylty>
    <MinTrip>36</MinTrip>
    <MaxTrips>41(36+5)</MaxTrips>
  </Loaylty>
<Loaylty>
    <MinTrip>36</MinTrip>
    <MaxTrips>41(36+5)</MaxTrips>
  </Loaylty>
<Loaylty>
    <MinTrip>42</MinTrip>
    <MaxTrips>72(42+30)</MaxTrips>
  </Loaylty>
</ns0:Loyalites>
Is it possible in Biztalk Map using functoids?

Sujith,
You got to buy me a drink :)
You can achive this using XSLT in your map, following XSLT will get the desired result:
<?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://BizTalk_Server_Project7.Schemdfa1" >
<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
<xsl:template match="/">
<xsl:apply-templates select="/DiscountStepList" />
</xsl:template>
<xsl:template match="/DiscountStepList">
<ns0:Loyalites>
<xsl:for-each select="DiscountStep">
<xsl:if test="position() =1">
<Loaylty>
<MinTrip>
<xsl:value-of select="position()" />
</MinTrip>
<MaxTrips>
<xsl:value-of select="NumberOfTrips/text()" />
</MaxTrips>
</Loaylty>
<xsl:call-template name="ConstructNextLoayltyNode">
<xsl:with-param name="i" select="2"/>
<xsl:with-param name="limit" select="count(/DiscountStepList/DiscountStep)"/>
<xsl:with-param name="vMaxTrips" select="NumberOfTrips/text()"/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</ns0:Loyalites>
</xsl:template>
<xsl:template name="ConstructNextLoayltyNode">
<xsl:param name="i"/>
<xsl:param name="limit"/>
<xsl:param name="vMaxTrips"/>
<xsl:if test="$i &lt;= $limit">
<Loaylty>
<MinTrip>
<xsl:value-of select="$vMaxTrips + 1" />
</MinTrip>
<MaxTrips>
<xsl:value-of select="$vMaxTrips + 1 +/DiscountStepList/DiscountStep[$i]/NumberOfTrips/text() " />
</MaxTrips>
</Loaylty>
<xsl:call-template name="ConstructNextLoayltyNode">
<xsl:with-param name="i" select="$i+1"/>
<xsl:with-param name="limit" select="$limit"/>
<xsl:with-param name="vMaxTrips" select="$vMaxTrips + 1 +/DiscountStepList/DiscountStep[$i]/NumberOfTrips/text()"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Note: You may have to change the namespace as yours. And also the output sample you have show has repeated node as following which is correct.
<Loaylty>
    <MinTrip>36</MinTrip>
    <MaxTrips>41(36+5)</MaxTrips>
  </Loaylty>
<Loaylty>
    <MinTrip>36</MinTrip>
    <MaxTrips>41(36+5)</MaxTrips>
  </Loaylty>
For your requirement you will get the out as following which your requirement:
<ns0:Loyalites xmlns:ns0="http://BizTalk_Server_Project7.Schemdfa1">
<Loaylty>
<MinTrip>1</MinTrip>
<MaxTrips>35</MaxTrips>
</Loaylty>
<Loaylty>
<MinTrip>36</MinTrip>
<MaxTrips>41</MaxTrips>
</Loaylty>
<Loaylty>
<MinTrip>42</MinTrip>
<MaxTrips>72</MaxTrips>
</Loaylty>
</ns0:Loyalites>
Regards,
M.R.Ashwin Prabhu
If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

Similar Messages

  • Message Mapping logic ...!!

    Hi Experts ,
    I am working on the below scenario where my Sender System is the Oracle Database system and Receiver System is SAP ECC
    basically JDBC->PI->IDOC  channels i am using . I need to create the below Mapping logic in order to satisfy the Interface Requirement
    Based on the Interface_Transaction_ID  each Idoc has to be Created and each Idoc should have corresponding Segments and line items . based on th value of GLAccount and Vendor Account
    My sender Payload is
    <row>
      <INTERFACE_TRANSACTION_ID>CFCV00000627</INTERFACE_TRANSACTION_ID>
      <DOC_HEADER_TEXT>5251/0115/000000/0000</DOC_HEADER_TEXT>
      <COMPANY_CODE>1610</COMPANY_CODE>
      <DOCUMENT_DATE>20110707</DOCUMENT_DATE>
      <POSTING_DATE>20110305</POSTING_DATE>
      <PERIOD>3</PERIOD>
      <DOCUMENT_TYPE>ZF</DOCUMENT_TYPE>
      <REFERENCE>45720-T</REFERENCE>
      <VENDOR_ACCOUNT></VENDOR_ACCOUNT> 
      <CF_MATERIAL_TYPE>MATTE</CF_MATERIAL_TYPE>
      <CF_ENTRY_POINT>610 Tank</CF_ENTRY_POINT>
      <CF_SOURCE>XNN</CF_SOURCE>
      <PAYMENT_TERMS></PAYMENT_TERMS>
      <BASELINE_DATE>20110305</BASELINE_DATE>
      <ASSIGNMENT>5251/0115/000</ASSIGNMENT>
       <TEXT>USD </TEXT>
       <GL_ACCOUNT>111810</GL_ACCOUNT>   
       <SPECIAL_GL_IND></SPECIAL_GL_IND>
        <PREV_DOC_NUMBER></PREV_DOC_NUMBER>
       <PREV_POSTING_DATE></PREV_POSTING_DATE>
    </row> 
    <row>
      <INTERFACE_TRANSACTION_ID>CFCV00000627</INTERFACE_TRANSACTION_ID>
      <DOC_HEADER_TEXT>5251/0115/000000/0000</DOC_HEADER_TEXT>
    <ASSIGNMENT>5251/0115/000</ASSIGNMENT>
       <TEXT>USD </TEXT>
       <GL_ACCOUNT>111821</GL_ACCOUNT>   
       <SPECIAL_GL_IND></SPECIAL_GL_IND>
        <PREV_DOC_NUMBER></PREV_DOC_NUMBER>
       <PREV_POSTING_DATE></PREV_POSTING_DATE>
    </row> 
    Row having GL_Account Value      E1BPACHE09,
                                                             E1BPACGL09, (GLvalue 111810)
                                                             E1BPACGL09, (GLvalue 111821)
                                                             E1BPACCR09,
                                                             E1BPACCR09,
                                                             E1PACEXTC  .
                                                             Field value=CFCV00000627
    Similary if Vendor_Account Value exist then only Vendor Segment (E1BPACAP09) must occur at target side
    Row having Vendor_Aaccount  Value     
                                                             E1BPACHE09,
                                                             c (Vendor value 123)
                                                             E1BPACAP09, (Vendor Value 124)
                                                             E1BPACCR09,
                                                             E1BPACCR09,
                                                             E1PACEXTC  .
                                                             Field value=CFCV00000628
    I have mapped GL_ACCOUNT -
    >E1BPACGL09 .
                             Vendor_Account---->E1BPACGL09.
    if any one have gone through simiar mapping logic kindly share and do the needfull ...
    Regards,
    Aziz khan .
    I

    Hi ,
    Here the requirement which i am looking for :
    Sender Side has below value
    <row>
         <INTERFACE_TRANSACTION_ID>CFCV00000627</INTERFACE_TRANSACTION_ID>
        <PERIOD>3</PERIOD>
        <DOCUMENT_TYPE>ZF</DOCUMENT_TYPE>
        <REFERENCE>45720-T</REFERENCE>
        <CF_MATERIAL_TYPE>MATTE</CF_MATERIAL_TYPE>
        <VENDOR_ACCOUNT>600046</VENDOR_ACCOUNT>
        <CF_ENTRY_POINT>610 Tank</CF_ENTRY_POINT>
        <CF_SOURCE>XNN</CF_SOURCE>
        <PAYMENT_TERMS></PAYMENT_TERMS>
        <BASELINE_DATE>20110305</BASELINE_DATE>
         <ASSIGNMENT>5251/0115/000</ASSIGNMENT>
         <GL_ACCOUNT>111810</GL_ACCOUNT>
         <USER_STATUS>TOHD</USER_STATUS>
         <PREV_POSTING_DATE></PREV_POSTING_DATE>
    </row>
    as you can see in the above Payload has  values where Row  is the Root element and under that the rest of fields occur (its a jdbc to idoc Scenario ) and here based on the Interface Trasaction ID the Idoc is generated . where each Idoc should have either GL Segment if GL Account Value has values and respectively Vendor idoc Segment has to be generated if Vendor Account details are present . the Sender Data will have either GL Account or Vendor Account value in a row not both. 
    below is the IDOC Strcuture how it looks for GL Account at Target side
    IDOC
      --->E1BPACHE09
            E1BPACGL09 (This is the GL Segment will have GL Account Line item)
            E1BPACAR09
            E1BPACAR09.
            E1BPACEXTC
              Filed1
    below out put should come when Vendor Account have Value
       IDOC     
            E1BPACHE09
            E1BPACAP09 (This is the Vendor Segment will have Vendor Account Line item)
            E1BPACAR09
            E1BPACAR09.
            E1BPACEXT09         
              Filed1
    Now when i duplicate the above Row
    Like
    <row>
          <INTERFACE_TRANSACTION_ID>CFCV00000627</INTERFACE_TRANSACTION_ID>
           <VENDOR_ACCOUNT></VENDOR_ACCOUNT>
           <GL_ACCOUNT>111810</GL_ACCOUNT>
    </row>
    <row>
          <INTERFACE_TRANSACTION_ID>CFCV00000627</INTERFACE_TRANSACTION_ID>
           <VENDOR_ACCOUNT></VENDOR_ACCOUNT>
           <GL_ACCOUNT>111811</GL_ACCOUNT>
    </row>
    <row>
          <INTERFACE_TRANSACTION_ID>CFCV00000627</INTERFACE_TRANSACTION_ID>
           <VENDOR_ACCOUNT></VENDOR_ACCOUNT>
           <GL_ACCOUNT>111812</GL_ACCOUNT>
    </row>
    I have Mapped the below fileds
    Interface_Transaction_ID-->SplitByValue(EachValue)>CollapseContext>IDOC 
    Interface_Transaction_ID -->Filed1 (IDOC/E1BPACEXTC/Filed1) 
    all the above 3 Row have been duplicated the 3 Rows will have 3 interface Transaction id Value=CFCV00000627 (which is same  as per the above Sender Payload ) and 3 GLAccount fields with values 111810,111811,111812 each
    If i test the data i should get the below output 1
    if GL account exists
      IDOC 1
            E1BPACHE09
            E1BPACGL09 (This is the GL Segment with value 111810)
            E1BPACGL09 (This is the GL Segment with value 111811)
            E1BPACGL09 (This is the GL Segment with value  111812)
            E1BPACAR09
            E1BPACAR0/
            E1BPACEXTC
              Filed1  (CFCV00000627)
    If Vendor account Exists then output 2  as follows
    IDOC     
              E1BPACHE09
             E1BPACAP09 (This is the Vendor Segment will have Vendor Account Line item)
             E1BPACAP09
             E1BPACAP09
             E1BPACAR09
             E1BPACAR09.
             E1BPACEXT09         
               Filed1  (CFCV00000627)
    How can i achive the above logic  .
    Regards,
    Aziz

  • Mapped logical system

    Hi Experts,
    I have a confusion to use the type of RFC connection like when
    to use ABAP connection and TCP/IP connections etc...
    I have defined one logical system and define one RFC destination and when  i am trying connect this two it is asking me to give Standard RFC destination for BAPI and dialog calls to connect to the logical system. i would like to know what is this ? why we need to give this?.
    and we assign this logical system to the Mapped logical system. i d like to know what is this mapped logical system and when we need to assign the logical system to this mapped system.
    Can anybody please clarify all my doubts.
    Thanks, Izaz.

    Hi Izaz,
    ABAP connections are given between 2 SAP systems and TCP/IP is used between ABAP and JAVA.
    Regards,
    Suman

  • Regarding Message Mapping Logic ...!

    Hi Experts ,
    I am working on the the below requirement  JDBC to IDoc scenarion in the mapping i need the below logic
    based on the existence of the Transaciton ID . the idoc followed by the segments should be created . for ex
    If Interface_Trasaction_ID= 456  THEN   Idoc 1 followed by Segments and line items
                                                                    E1BPACHE09,
                                                                    E1BPACCR09
                                                                    E1BPACCR09,
                                                                    E1PACEXTC  .
                                                                        Field value=456
    If Interface_Transaction_ID =457 THEN  Idoc  2 followed by Segments and  line items
                                                                   E1BPACHE09,
                                                                   E1BPACCR09
                                                                   E1BPACCR09,
                                                                   E1PACEXTC  .
                                                                        Field value=457
    To satisfy the above logic i have mapped Transaction id > SplitByValue->CollapseContext--->Idoc
    But the same Mapping Logic is not working when Sender payload is triggred having  Repeated Transcation_Id value ias given below if Transaction ID= 456 ,
                  Transaction ID= 457,
                  Transaction ID= 457,
                  Transaction ID= 456 .
    then  output should have only 2 Idoc  Followed by segments where Field Value will be 456, 457
    I have mapped Transaction id -->Field Value .
    let me know how can achive the above logic ...!!

    Hi Aziz,
    you can use UDF
    Transaction IDRemoveContext-->sortUDF- SplitByValue->CollapseContext--->Idoc
    public void removeDuplicate(String[] Value, ResultList result, Container container) throws StreamTransformationException{
    String temp = Value[0];
    result.addValue(Value[0]);
    for(int i=0;i<Value.length;i++)
       if(!(Value<i>.equals(temp)))
            result.addValue(Value<i>);
       temp=Value<i>;

  • BizTalk Map: Grouping CRM Response XML based on the ID field in Custom XSLT

    Hi,
    I will receive a CRM response as below. 
    <ns0:RetrieveMultipleResponse xmlns:ns0="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:ns2="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ns3="http://schemas.microsoft.com/xrm/2011/Metadata" xmlns:ns5="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:ns1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" xmlns:ns4="http://schemas.microsoft.com/xrm/2011/Contracts"><ns0:RetrieveMultipleResult>    <ns4:Entities>      <ns4:Entity>        <b:Attributes xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">            <b:KeyValuePairOfstringanyType>            <c:key>ccx_datevaccineinfostatementpresented</c:key>            <c:value i:type="d:dateTime" xmlns:d="http://www.w3.org/2001/XMLSchema">2012-08-14T04:00:00Z</c:value>          </b:KeyValuePairOfstringanyType>          <b:KeyValuePairOfstringanyType>            <c:key>ccx_administeredamount</c:key>            <c:value i:type="d:decimal" xmlns:d="http://www.w3.org/2001/XMLSchema">0.75000000</c:value>          </b:KeyValuePairOfstringanyType>          <b:KeyValuePairOfstringanyType>            <c:key>ccx_immunizationid</c:key>            <c:value i:type="d:guid" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/">826c2b0e-a349-e411-866c-00155d1e1f77</c:value>          </b:KeyValuePairOfstringanyType>     </b:Attributes>  </ns4:Entity>   <ns4:Entity>        <b:Attributes xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">            <b:KeyValuePairOfstringanyType>            <c:key>ccx_datevaccineinfostatementpresented</c:key>            <c:value i:type="d:dateTime" xmlns:d="http://www.w3.org/2001/XMLSchema">2012-08-14T04:00:00Z</c:value>          </b:KeyValuePairOfstringanyType>          <b:KeyValuePairOfstringanyType>            <c:key>ccx_administeredamount</c:key>            <c:value i:type="d:decimal" xmlns:d="http://www.w3.org/2001/XMLSchema">0.25000</c:value>          </b:KeyValuePairOfstringanyType>          <b:KeyValuePairOfstringanyType>            <c:key>ccx_immunizationid</c:key>            <c:value i:type="d:guid" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/">766c2b0e-a349-e411-866c-00155d1e1f77</c:value>          </b:KeyValuePairOfstringanyType>     </b:Attributes>  </ns4:Entity><ns4:Entity>        <b:Attributes xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">            <b:KeyValuePairOfstringanyType>            <c:key>ccx_datevaccineinfostatementpresented</c:key>            <c:value i:type="d:dateTime" xmlns:d="http://www.w3.org/2001/XMLSchema">2012-08-14T04:00:00Z</c:value>          </b:KeyValuePairOfstringanyType>          <b:KeyValuePairOfstringanyType>            <c:key>ccx_administeredamount</c:key>            <c:value i:type="d:decimal" xmlns:d="http://www.w3.org/2001/XMLSchema">0.7500000000</c:value>          </b:KeyValuePairOfstringanyType>          <b:KeyValuePairOfstringanyType>            <c:key>ccx_immunizationid</c:key>            <c:value i:type="d:guid" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/">826c2b0e-a349-e411-866c-00155d1e1f77</c:value>          </b:KeyValuePairOfstringanyType>     </b:Attributes>  </ns4:Entity></Entities></ns0:RetrieveMultipleResult></ns0:RetrieveMultipleResponse>
    I have  to count the distinct Entities based on ccx_immunizationid value & also I have to group the fields if both entity has same immunization ID. If the xml file (without namespace) and the field is <ccx_immunizationid>2323</ccx_imunizationid>,
    I can use something like below,
    <xsl:template match="//Entity/Attributes[not(./ccx_immunizationid= preceding::ccx_immunizationid)]">
    but here, I have to look for the key 'ccx_immunizationid' and its value. 
    I am using custom xslt in BizTalk map. Please help. Thanks.
    Regards,
    Lakshmi

    You need to get the distinct record filtered by "value" field whose "key" is "ccx_immunizationid" i.e <c:key>ccx_immunizationid</c:key>".
    So you need to use the XPath with syntax: 
    /*[not(@name = preceding::*/@name)]
    So in your case, the XPath value will be like the following:
    /*[local-name()='RetrieveMultipleResponse' and namespace-uri()='http://schemas.microsoft.com/xrm/2011/Contracts/Services']/*[local-name()='RetrieveMultipleResult' and namespace-uri()='http://schemas.microsoft.com/xrm/2011/Contracts/Services']/*[local-name()='Entities' and namespace-uri()='http://schemas.microsoft.com/xrm/2011/Contracts']/*[local-name()='Entity' and namespace-uri()='http://schemas.microsoft.com/xrm/2011/Contracts']/*[local-name()='Attributes' and namespace-uri()='http://schemas.microsoft.com/xrm/2011/Contracts']/*[local-name()='KeyValuePairOfstringanyType' and namespace-uri()='http://schemas.microsoft.com/xrm/2011/Contracts'][*[local-name()='key' and namespace-uri()='http://schemas.datacontract.org/2004/07/System.Collections.Generic']/text() ='ccx_immunizationid'][not(*[local-name()='value' and namespace-uri()='http://schemas.datacontract.org/2004/07/System.Collections.Generic'] = preceding::*[local-name()='value' and namespace-uri()='http://schemas.datacontract.org/2004/07/System.Collections.Generic'])]
    You may need to change the namespaces according to yours. This XPath would give you an idea of how to use the distinct XPath (1.0) snystax as shown above in your XML.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • No mapping logic : soap to proxy scenario

    Hi,
    I have a soap to proxy scneario with no mapping logic.wanted to confirm certain things.
    Wanted to confirm certain things.
    1) So i can exclude mapping and interface mapping step since i just need to pass value to proxy ?
    2) in interface determination ,what i need to provide for interface mapping ?
    3) sync proxy will be generated from one outbound message interface "( there will be only one outbound message interface which will be synchronous  : which will be synchronous ?
    4) in receiver business system , i need not put any message interface since we only have one outbound sync message interface
    Thnx

    how many message interfaces wil be needed for synchronous scneario without mapping ?
    Two....one for Sender (Outbound) and one for receiver (Inbound)
    in case ur answer is 2 for above ? proxy needs to be generated from outbound or inbound interface?
    For your SOAP --> XI/ PI --> PROXY, scenario the proxy should be generated for the inbound interface
    1) So i can exclude mapping and interface mapping step since i just need to pass value to proxy ?
    If both the source and target structures are the same , then you do not need to perform mapping....do not create message and Interface mapping .....you should however create Interface Determination with appropriate Source and Target interfaces.
    2) in interface determination ,what i need to provide for interface mapping ?
    Nothing.....including a mapping is not mandatory.
    4) in receiver business system , i need not put any message interface since we only have one outbound sync message
    interface
    The message interface needs to be associated with the Business System.....it will be the inbound interface for SOAP --> XI --> PROXY scenario.
    Regards,
    Abhishek.

  • BizTalk map Julian date

    Hi,
    how can i convert date into julian date in BT map. 
    Thanks in adv.
    2Venture2

    Try this in BizTalk map via an inline C# scripting functoid
    public static string ToJulian(string strdateTime)
    DateTime dateTime = Convert.ToDateTime(strdateTime);
    int day = dateTime.Day;
    int month = dateTime.Month;
    int year = dateTime.Year;
    if (month < 3)
    month = month + 12;
    year = year - 1;
    long dt = day + (153 * month - 457) / 5 + 365 * year + (year / 4) - (year / 100) + (year / 400) + 1721119;
    return dt.ToSTring(dt);
    or this returns long, and the input parameter is datetime
    public static long ToJulian(DateTime dateTime)
    int day = dateTime.Day;
    int month = dateTime.Month;
    int year = dateTime.Year;
    if (month < 3)
    month = month + 12;
    year = year - 1;
    return day + (153 * month - 457) / 5 + 365 * year + (year / 4) - (year / 100) + (year / 400) + 1721119;
    Refer this article for more details:http://mikearnett.wordpress.com/2011/09/13/c-convert-julian-date/
    Following in the what we have been using in our maps, this has two static methods. One for standard datetime to Julian and another to convert Short datetime to Julian:
    public int ToJulian(string dt)
    try
    DateTime date = DateTime.Parse(dt);
    return ((date.Year - 1900) * 1000) + date.DayOfYear;
    catch
    return 0;
    /// <summary>
    /// Convert to Julian from dd/mm/yy
    /// </summary>
    /// <param name="dt"></param>
    /// <returns></returns>
    public int ToJulianFromShortDT(string dt)
    try
    DateTime date = new DateTime(int.Parse(dt.Substring(6, 2))+2000, int.Parse(dt.Substring(3, 2)), int.Parse(dt.Substring(0, 2)));;
    return ((date.Year - 1900) * 1000) + date.DayOfYear;
    catch
    return 0;
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Biztalk Map: Repeated node

    Hi,
    Please find below Input file
    <Vin_Decoder>
    <Process>
    <Risk>
    <Line>
    <Exposer>
    <Type>VIN</type>
    <Svalue>123456789123456789</Svalue>
    </Exposer>
    <Exposer>
    <Type>Year</type>
    <Svalue>2014</Svalue>
    </Exposer>
    <Exposer>
    <Type>MAKE</type>
    <Svalue>2546</Svalue>
    </Exposer>
    <Exposer>
    <Type>Discripttion</type>
    <Svalue></Svalue>
    </Exposer>
    </line>
    </risk>
    <Risk>
    <Line>
    <Exposer>
    <Type>VIN</type>
    <Svalue>123456789987654321</Svalue>
    </Exposer>
    <Exposer>
    <Type>Year</type>
    <Svalue>2013</Svalue>
    </Exposer>
    <Exposer>
    <Type>MAKE</type>
    <Svalue>6789</Svalue>
    </Exposer>
    <Exposer>
    <Type>Discripttion</type>
    <Svalue>kfjdklf</Svalue>
    </Exposer>
    </line>
    </risk>
    </Process>
    </Vin_Decoder>
    and i am expecting the out put format
    <Vin_Decoder>
    <Decoder>
    <VIN>123456789123456789</VIN>
    <Year>2014</Year>
    <Make>2546</Make>
    <Description></Description>
    </Decoder>
    <Decoder>
    <VIN>123456789987654321</VIN>
    <Year>2013</Year>
    <Make>7896</Make>
    <Description>kfjdklf</Description>
    </Decoder>
    </Vin_Decoder>
    please suggest me how to do this in biztalk map..
    Thanks..

    Hi,
    In the Vin_Decoder schema create a "Decoder" Child Record and make it optional. Inside the Decoder" Record create the all the Field Elements like VIN, Year, etc. Create a map where the source and destination is the Vin_Decoder schema. Map to the field
    elements inside the Decoder" Record.
    Kind regards,
    Tomasso Groenendijk
    Blog 
    |  Twitter
    MCTS BizTalk Server 2006, 2010
    If this answers your question please mark it accordingly

  • Invoice PO issue in BizTalk Map

    Hi All,
    I did get below error while I was testing the map. I have reloading the map so many times still I'm getting below error
    Invoking component...
    C:\somepath.btm: error btm1023: Exception Caught: The map contains a reference to a schema node that is not valid.  Perhaps the schema has changed.  Try reloading the map in the BizTalk Mapper.  The XSD XPath of the node is: /*[local-name()='<Schema>']/*[local-name()='']/*[local-name()='']/*[local-name()='INVOICE']/*[local-name()='POSITEID']
    Component invocation succeeded.
    How can i fix this error could you please assist me on this.
    Thanks & Regards,
    Vasu

    Hi Vasu,
    1) Try "CLEAN SOLUTION" and then try,
    2) If that doesnt fix. Choose the properties of the map and disable the “Ignore Namespaces for Links” like this:
    Refer: Two nodes on same
    level with same name but different namespace
    3) If that doesn't fix the issue, Refer this link. FIX:
    Error message when you validate a BizTalk map in BizTalk Server 2006 R2 or in BizTalk Server 2009 if the map and its schemas are in a separate project
    Rachit
    Please mark as answer or vote as helpful if my reply does

  • Need Mapping logic for the following scenario

    Hi everyone,
    I need a mapping logic for the following scenario.
    For the same order no with same material no, the quantity should be summed and only one idoc should be created.
    For the same order no with different material no, no need to sum the quantity and only one idoc should be created.
    For example:
    Source Structure:
    Ord No      Mat No      QTY
    12               1               2
    13               1               3
    13               2               1
    12               2               4
    15               1               5
    14                3              7
    12               1              6
    Target Structure:
    Ord No      Mat No      QTY
    12               1               8
    12               2               4
    13               1               3
    13               2               1
    14               3              7
    15               1              5
    Thanks in Advance

    Try the graphical mapping as shown below using concat with a space as delimite and UDF to split the value again by space.
    1. Idoc node
    (RootContext)
    OrdNo
         |concat[ ] -> sort[asending] -> SplitByValue -> collapseContexts -> Idoc
    MatNo                case sensitive    [ValueChange]                              
    (RootContext)
    2. OrdNo
    OrdNo(RC)
         |concat[ ] -> sort[asending] ->SplitByValue->collapseContexts->SplitByVale-> UDF to fetch ordno  -> OrdNo
    MatNo(RC)           case sensitive    [ValueChange]                [eachValue]   (return var1.split(" ")[0];)
    3. MatNo
    OrdNo(RC)
         |concat[ ] -> sort[asending] -> SplitByValue ->collapseContexts->SplitByVale-> UDF to fetch ordno  -> MatNo
    MatNo(RC)              case sensitive    [ValueChange]                  [eachValue]   (return var1.split(" ")[1];)
    4. Qty
                   [asending,case sensitive]               
                   --  sortByKey -----> formatByExample -> sum ->Qty
    OrdNo(RC)           |          |          ^          
         |concat[ ] -> |            Qty(RC)          |
    MatNo(RC)           |                |     
                   --sort[asending]-> SplitByValue
                       case sensitive    [ValueChange]
    Regards,
    Sunil Chandra

  • Create multiple line item from one line item in BizTalk mapping

    Hi,
    In one of our new requirement we need to create 3 line items for every line item we are receiving with same value but in the below format.
    Sample Input:
    <EmpId>1234</EmpId><Name>ABCD></Name><Dept>YYY</Dept><Year>2014</Year><Desc1>D1</Desc1><Desc2>D2</Desc2><Desc3>D3</Desc3><Valid>Yes</Valid>
    Sample Output in Flatfile:
    1234,ABCD,,,D1,Yes
    1234,ABCD,YYY,,D2,Yes
    1234,ABCD,YYY,2014,D3,Yes
    Can you Pls help me in creating the mapping in above format.
    Thanks in advance,
    Regards,
    Elango
    Chennai.
    Mark As Answer or Vote As Helpful if My Reply Does.

    Elango,
    Before I explain about the solution, make sure when you give inputs/requirement in forums for us to help you, pay attention.
    The input instance you have shown
    Doesn’t have a root element
    Has a typo - <Name>ABCD></Name> -Element has invalid “>” character.
    This makes us to spend more time in cleansing your input and then find out solution.
    We are here to help you, so help us to help you better.
    Anyway, coming to the solution
    You have to create map with a structure similar to the below shown image:
    Here destination schema is a flat file schema with comma-delimited fields.
    If you look into the destination schema, it look similar to your input schema, but there is just one “Desc” field instead of “Desc1”, “Desc2”, “Desc3” in your source schema. In destination, the
    record has to repeat with same values for rest of the fields. And for “Desc” in destination schema will have corresponding index value of “Desc1” or “Desc2” or “Desc3” from source. i.e. first node of destination will have value of “Desc1” from source to “Desc”
    field in destination, second node of destination will have value of “Desc2” from source to “Desc” field in destination and third node of destination will have value of “Desc3” from source to “Desc” field in destination.
    I use XSLT in the map, with recursive template which will repeat for 3 times. I have given comment in the XSLT for your benefit.
    <?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">
    <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
    <xsl:template match="/">
    <xsl:apply-templates select="/Root" />
    </xsl:template>
    <xsl:template match="/Root">
    <Record>
    <!--Call the template with index and counter of 3. There times as you wanted for every item-->
    <xsl:call-template name="LintItemTemp">
    <xsl:with-param name="i">1</xsl:with-param>
    <xsl:with-param name="count">3</xsl:with-param>
    </xsl:call-template>
    </Record>
    </xsl:template>
    <xsl:template name="LintItemTemp">
    <xsl:param name="i" />
    <xsl:param name="count" />
    <Details>
    <EmpId>
    <xsl:value-of select="EmpId/text()" />
    </EmpId>
    <Name>
    <xsl:value-of select="Name/text()" />
    </Name>
    <Dept>
    <xsl:value-of select="Dept/text()" />
    </Dept>
    <Year>
    <xsl:value-of select="Year/text()" />
    </Year>
    <!--as in your output instance, Lineitem1 will have value of Desc1-->
    <xsl:if test ="($i =1)">
    <Desc>
    <xsl:value-of select="Desc1/text()" />
    </Desc>
    </xsl:if>
    <!--as in your output instance, Lineitem2 will have value of Desc3-->
    <xsl:if test ="($i =2)">
    <Desc>
    <xsl:value-of select="Desc2/text()" />
    </Desc>
    </xsl:if>
    <!--as in your output instance, Lineitem3 will have value of Desc3-->
    <xsl:if test ="($i =3)">
    <Desc>
    <xsl:value-of select="Desc3/text()" />
    </Desc>
    </xsl:if>
    <Valid>
    <xsl:value-of select="Valid/text()" />
    </Valid>
    <xsl:value-of select="./text()" />
    </Details>
    <!--Recursive template, i.e. calling the template again for 3 times as your requirement-->
    <xsl:if test="$i &lt; $count">
    <xsl:call-template name="LintItemTemp">
    <xsl:with-param name="i">
    <xsl:value-of select="$i + 1"/>
    </xsl:with-param>
    <xsl:with-param name="count">
    <xsl:value-of select="$count"/>
    </xsl:with-param>
    </xsl:call-template>
    </xsl:if>
    </xsl:template>
    </xsl:stylesheet>
    So the input and output will look like the below:
    You can change the schema/XSLT and its corresponding namespaces as you want.
    When the above shown output is send to a custom-pipeline with flat file assembler in send port will output the above shown output to the flat-file structure as you wanted. Again, I repeat you
    to use flat-file file schema with comma-delimited fields as the destination schema in the above shown map for you to get the flat-file output as you needed.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Error : message mapping logic in PI

    Dear Team,
    Please find the source and target structures..
    Source ::
    ->MT
    -->records
    --->matnr
    --->batch
    --->submatnr(s)
    Target::
    ->ZRFC
    -->Import
    --->Item
    >matnr
    >batch
    >submatnr
    1) It is SOAP to RFC scenario. In Source strcuture for one matnr , we have one or more submatnrs.
    2)RFC in R/3 contains Import parameters as..matnr,batch,submatnr(onlyone).
    3)I want to build mapping - for each submatnr in source I want to create one complete record in target .i.e
    if matnr contains 2 submatnrs in source , i want to create 2 records at target side like
    first record - matnr,batch,submatnr 
    second record - matnr,batch,submatnr.
    here in both records the matnr and batch values are same , which we have taken from source but submatnrs changed.
    Can any body help me how to build mapping.
    -Drumi

    Hi,
    I assumed that submatnr occurance 1 to unbounded...
    here is the logic
    map
    Submatnr----->SplibyValue(ValueChange)-->RemoveContect-->Item
    matnr1---->useoneAsmany(1st argument Matnr1,second and third arugument submatnr)--->splitbyValue(EachValue)-->Matnr1.
    batch1---->useoneAsmany(1st argument batch11,second and third arugument submatnr)--->splitbyValue(EachValue)-->batch1
    submatnr-->removecontext-->splitbyevalue(eachvalue)--->submatnr
    Regards,
    Raj

  • Question about mapping logical sources to dimensions

    1) On my physical layer I have one fact table (FACTS_DETAILS) linked with CATEGORY dimension table. Other fact tables (aggregated data) don't linked with this CATEGORY dimension with physical joins.
    2) On my BMM layer I have mapped my dimension "Category" with my FACT_DETAILS.
    3) Other LSTs don't mapped on "Category" dimension, as they do not linked with Categories on physical layer.
    4) When I try to display detailed facts by CATEGORY - it's ok.
    5) When I add another dimension (For example, COUNTRY) i get error, because COUNTRY dimension isn't compatible with my FACTS_DETAILS.
    The question is: how to avoid displaying error message at Answers in such situation? Maybe it is possible just to not display data without error message?

    Sounds like you need to architect your physical/logical model a bit better and also you need to set the appropriate levels in the LTS for your facts and dimension logical table sources.

  • Need help in Mapping Logic

    Hi all,
    In mapping i need to mapp like this
    Idoc--file scenario, sending delivery document to file system
    in header of file structure, i have a field called Total Units, the logic for this field shld be
    Sum up the field ZCONV_QUAN for each delivery.
    How to do this please help me
    Regards

    Hi satish,
    I have to do some thing more in this.
    As you said i mapped the field to sum and to target field.its fine
    Now this field is there at header level and comes only ones, i should repeat this field as many number of times the line item repeats.
    Now iam using the ligic like this
    ZCONV_QUAN--UseOneAsMany-Sum--Target Field
    to UseOnaAsMany function i mapped ZCONV_QUAN as first argument and changed the context to Idoc and the second argument as line Item segment changed the context to Idoc, third argument as line itme segment.
    its giving the error as
    Too many values in first queue in function useOneAsMany. It must have the same number of contexts as second queue
    Regards

  • Help needed on Mapping logic

    Hi guys,
    I have logic like,
    pernr>logic>pernr.
    Pernr is the first field.
    Whenever the logic fails, it should not process rest of the below fields.
    it should directly go to next record.
    Any ideas.......
    santosh.

    You can achieve this using gloval variable.
    1. right click on the parent node  of pernr. -
    >Add Variable (say ifPernrTrue)
    2. Map this variable with the same logic and give value "true" if logic successful and "false" if logic fails
    Whenever the logic fails, it should not process rest of the below fields.
    3.Map rest of fields as :
    ifPernrTrue (the variable u created) \
    >   if  (without else )  -
    > fields...
                   source filed     /

Maybe you are looking for

  • Key mapping problem for web forms !!!

    Hi all, I have implemented forms 6 on the web using OAS 4.0.7 on WinNT SP 3 workstation. I have modified FMRWEB.RES file for activating F9 - LOV. We have a customized toolbar for our application. There are also shortcut keys defined for the same. For

  • Minimize and closing ITunes

    After installing both version 7 and 8 of ITunes, it is now very hard to minimize or close the program using the _ or X in the upper right hand corner. If I click several times on each and then click serveral times at ramdon on othe parts of the progr

  • Do we have any tool to migrate SharePoint 2010 to 2013?

    Hi,   Why Microsoft didn't provided the User friendly tool to migrate the solution from SP 2010 farm to SP 2013 farm? In order to take the backup and restore the database, run some powershell commands and validating the process , instead they can pro

  • Moving images from one libray to a second library

    Hi all, There must be someone on here who can help. When you open iPhoto if you hold the alt key at the same time you can create or open different iPhoto libraries on your mac. So how do you move some of the images in one library to a second library?

  • Problem with Collections after Upgrade to Apex 4.02

    Hi, We are using oracle 10g with Apex 4.02. I installed Jari's application for data import from excel. http://dbswh.webhop.net/apex/f?p=BLOG:READ:0::::ARTICLE:126300346812330 It is working fine in our test environment but in production environment it