Use grouping dynamic data in tables

Top Previous Topic  Print this topic

This tutorial shows you how to group data from XML in tables.

 

In the example below we will group the titles of CDs by the country they were released in.

We have already assigned a sample data source named "cdcatalog.xml" from Samples\XML Samples\Template Samples to the document.

In Design View, start by inserting a single row table with two columns from the Insert tab.

Then right-click on the first cell and select Insert>Group Above... or go to Layout tab and select Insert Group>Group Above from the Groups group.

 

grouping1

 

A dialog box named Group By will appear.

Click on the right arrow in the Group Context textbox to browse for the context used for grouping. In the Edit Expression dialog box select the ns:cd node which will be in the /ns:catalog/ns:cd context.

Then click on the right arrow in the Group By XPath textbox to browse for the path used for grouping. In the Edit Expression dialog box select the @country field.

Check "Merge content with first row" if you want to merge the content of the new row with the content of the first row.

 

grouping2

 

grouping3

 

 

Drag and drop the @country field from the Data Source dialog bar and place it in the first cell from the first row.

 

Right-click on the second row and select Convert to Repeating Row. In the Edit Expression dialog box that appears browse for the ns:cd node.

 

grouping4

 

Drag and drop the @title field from the Data Source dialog bar and place it in the second cell of the second row.

 

grouping5

 

Finally, right click on the cell that contains the @country field and select Span>Increase Row Span. You may also delete the last row which is not used by right-clicking on it and selecting Delete.

 

grouping6

 

Print Layout:

 

grouping7