Example 5: Marshal with Optimized Combine

When combining nodes for large amounts of data, you can optimize the operation using the Optimized Combine feature in the XML Structure tab. You need to set the Sort/ORDER BY method to "Optimize Combine Using ORDER BY" in the XML Structure tab toolbar.

 

<xml>
<PurchaseOrder OrderID="1">
<Customer>
<Company>Berman</Company>
<Address street="85 Walk Ave" city="Los Angeles" state="CA" zip="78554" country="USA" />
<Contact name="John Mena" title="Mr." phone="(882) 452 5568" mobile="(882) 123 5688" />
</Customer>
<SalesRepresentative Name="JEAN Holtzman" Phone="(558) 899-5899" />
<LineItem Quantity="5" UnitPrice="999.99" Discount="0" Total="4999.95">
<Product>
    <Name>conference table</Name>
    <UnitsInStock>32</UnitsInStock>
    <InventoryDate>2002-09-20T00:00:00.0</InventoryDate>
    <Category Name="Desk" Description="Workstations and executive desks" />
</Product>
</LineItem>
<LineItem Quantity="50" UnitPrice="365.50" Discount="0" Total="18275.00">
<Product>
    <Name>side chair</Name>
    <UnitsInStock>11</UnitsInStock>
    <InventoryDate>2002-09-20T00:00:00.0</InventoryDate>
    <Category Name="Chair" Description="Office chairs" />
</Product>
</LineItem>
<LineItem Quantity="10" UnitPrice="225.80" Discount="0" Total="2258.00">
<Product>
    <Name>tall vertical file</Name>
    <UnitsInStock>35</UnitsInStock>
    <InventoryDate>2002-09-20T00:00:00.0</InventoryDate>
    <Category Name="Filing Cabinet" Description="Lateral and vertical filing cabinets" />
</Product>
</LineItem>
<LineItem Quantity="8" UnitPrice="290.00" Discount="0" Total="2320.00">
<Product>
   <Name>tall bookshelf</Name>
   <UnitsInStock>19</UnitsInStock>
   <InventoryDate>2002-09-20T00:00:00.0</InventoryDate>
   <Category Name="Shelving" Description="Bookshelves and storage shelves" />
</Product>
</LineItem>
<OrderDate>2002-12-06T00:00:00.0</OrderDate>
<RequiredDate>2002-12-20T00:00:00.0</RequiredDate>
<ShipDate>2002-12-15T00:00:00.0</ShipDate>
<Taxrate>0.0000</Taxrate>
<SubTotal>27852.95</SubTotal>
<TotalAmount>27852.95</TotalAmount>
<Terms>0</Terms>
</PurchaseOrder>
</xml>

Examples

1.

Marshal Without Combine

No settings have been made in the XML Structure tab

2.

Marshal with Combine

XML output combines all PurchaseOrder nodes that have a matching value for the OrderID node.

3.

Marshal with Combine and Group

 XML output groups  all matching elements (LineItem) together

4.

 

Marshal with Combine and Order By

XML output contains records retrieved from the database using an ORDER BY clause

5.

Marshal with Optimized Combine

This page.

See Also

Marshal with Combine Project
XML Structure Tab

Introduction to Combining Nodes in XML Output when Marshalling

Combining Duplicate Elements in XML Output

Customizing Combine Settings for XML Output