|
| Hi,
I have a requirement where I need to map xml schema that holds order
records that hold both header and line details of many orders in
sequence into a structured Order Header-Line format.[Basically header
information is redundant per line in an order] and now I need to map
this information into a structure where I need to identify the header
and related lines and put them in a xml schema format as mentioned
below. To acheive this I have created a Inline C# code that identifies
the new header and returns true or false [Code is somethinglike if 4
elements(CompanyNumber, DivisionCode, BranchNumber, CustomerPO) in the
header have same values that means this is one order header and
associated other attributes are lines.]. In the map, making use of the
conditional looping I am trying to create a single Header node and
associate related lines to this Order. I am able to succeed in creating
the Header and getting the details also but since Header and Line nodes
are at the same level I am getting the line nodes with the parent
node(Order) since the conditional looping is set first I am getting the
first Order with Header and related line properly but when its looping
thru the second input record BizTalk is generating the root again and
creating the first order's second line under this root node though
Header is suppressed I am not getting the expected output.
Input Schema:
<LegacyOrder>
<Record>
<CompanyNumber>
<DivisionCode>
<BranchNumber>
<CustomerPO>
<ProductCode>
<OrderedQuantity>
<RequestedDeliveryDate>
<CancelDate>
<EntryDate>
</Record>
</LegacyOrder>
Output Schema:
<MyOrders>
<Order>
<Header>
<Source>
<CompanyNumber>
<DivisionCode>
<ControlNumber>
<SoldToCustomerNumber>
<PONumber>
<FormCode>
<EntryDate>
<RequestedDeliveryDate>
<CancelDate>
<TotalLines>
<TotalUnits>
<SpecialInstructions1>
<SpecialInstructions2>
<SpecialInstructions3>
</Header>
<Details>
<Detail>
<ProductCode>
<Quantity>
</Detail>
</Details>
</Order>
</MyOrders>
Input XML Data:
<LegacyOrder>
<Record>
<CompanyNumber>10</CompanyNumber>
<DivisionCode>0004</DivisionCode>
<BranchNumber>11579</BranchNumber>
<CustomerPO>7785641</CustomerPO>
<ProductCode>111700</ProductCode>
<OrderedQuantity>00003</OrderedQuantity>
<RequestedDeliveryDate>2002-07-27</RequestedDeliveryDate>
<CancelDate>2002-08-13</CancelDate>
<EntryDate>2002-07-19</EntryDate>
</Record>
<Record>
<CompanyNumber>10</CompanyNumber>
<DivisionCode>0004</DivisionCode>
<BranchNumber>11579</BranchNumber>
<CustomerPO>7785641</CustomerPO>
<ProductCode>113500</ProductCode>
<OrderedQuantity>00003</OrderedQuantity>
<RequestedDeliveryDate>2002-07-27</RequestedDeliveryDate>
<CancelDate>2002-08-13</CancelDate>
<EntryDate>2002-07-19</EntryDate>
</Record>
<Record>
<CompanyNumber>10</CompanyNumber>
<DivisionCode>0004</DivisionCode>
<BranchNumber>11579</BranchNumber>
<CustomerPO>7785641</CustomerPO>
<ProductCode>116100</ProductCode>
<OrderedQuantity>00003</OrderedQuantity>
<RequestedDeliveryDate>2002-07-27</RequestedDeliveryDate>
<CancelDate>2002-08-13</CancelDate>
<EntryDate>2002-07-19</EntryDate>
</Record>
</LegacyOrder>
Expected Output:
<MyOrders>
<Order>
<Header>
<CompanyNumber>10</CompanyNumber>
<DivisionCode>0004</DivisionCode>
<SoldToCustomerNumber>11579</SoldToCustomerNumber>
<PONumber>7785641</PONumber>
<EntryDate>2002-07-19</EntryDate>
<RequestedDeliveryDate>2002-07-27</RequestedDeliveryDate>
<CancelDate>2002-08-13</CancelDate>
</Header>
<Details>
<Detail>
<ProductCode>111700</ProductCode>
<Quantity>00003</Quantity>
</Detail>
</Details>
<Details>
<Detail>
<ProductCode>113500</ProductCode>
<Quantity>00003</Quantity>
</Detail>
</Details>
<Details>
<Detail>
<ProductCode>116100</ProductCode>
<Quantity>00003</Quantity>
</Detail>
</Details>
</Order>
<MyOrders>
Present Output:
<MyOrders>
<Order>
<Header>
<CompanyNumber>10</CompanyNumber>
<DivisionCode>0004</DivisionCode>
<SoldToCustomerNumber>11579</SoldToCustomerNumber>
<PONumber>7785641</PONumber>
<EntryDate>2002-07-19</EntryDate>
<RequestedDeliveryDate>2002-07-27</RequestedDeliveryDate>
<CancelDate>2002-08-13</CancelDate>
</Header>
<Details>
<Detail>
<ProductCode>111700</ProductCode>
<Quantity>00003</Quantity>
</Detail>
</Details>
</Order>
<Order>
<Details>
<Detail>
<ProductCode>113500</ProductCode>
<Quantity>00003</Quantity>
</Detail>
</Details>
</Order>
<Order>
<Details>
<Detail>
<ProductCode>116100</ProductCode>
<Quantity>00003</Quantity>
</Detail>
</Details>
</Order>
<MyOrders>
The parent node i.e Orders is repeating for each detal/line. How to
supress this node?
Appreciate if some one can help resolve this...
TIA,
Kiran
|
|