Query Portion of the Report

The following is the query portion of the crosstab report sample. The names of the data items are shown in bold.
<report xmlns="http://developer.cognos.com/schemas/report/7.0/" 
expressionLocale="en-us">
 <modelPath>/content/package[@name='GO Sales and Retailers']
 /model[@name='model']</modelPath>
 <queries>
  <query name="Query1">
   <source>
    <model/>
   </source>
   <selection>
    <dataItem name="Product line" aggregate="none"> 
     <expression>[gosales_goretailers].[Products].[Product line]</expression>
    </dataItem>
    <dataItem name="Product type" aggregate="none">
     <expression>[gosales_goretailers].[Products].[Product type]</expression>
    </dataItem>
    <dataItem name="Return quantity" aggregate="total">
     <expression>[gosales_goretailers].[Orders].[Return quantity]</expression>
    </dataItem>
    <dataItem name="Order method" aggregate="none">
     <expression>[gosales_goretailers].[Orders].[Order method]</expression>
    </dataItem>
    <dataItem name="Total(Order method)">
     <expression>total(currentMeasure within set [Order method])</expression>
    </dataItem>
    <dataItem name="Total(Product type)">
     <expression>total(currentMeasure within set [Product type])</expression>
    </dataItem>
   </selection>
  </query>
 </queries>
	...
 </report>

The query portion of the report specification must contain all the data items that will appear in the crosstab report.

In this sample, the query contains six data items or dataItem elements. Four of the data items return data from the model. They are Product type, Product line, Order method, and Return quantity. The Product type and Product line appear in the crosstab rows. The Order method appears in the crosstab columns. The Return quantity appears at the intersection points of the rows and columns.

The last two data items are calculations that render totals in the report. For more information, see Summarize Data.