Query Portion of the List Report Sample
For more information about the queries
element,
see Queries Element and queries
.
The following is the XML for the queries
element
in this list report sample.
<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 aggregate="none" name="Product name">
<expression>[gosales_goretailers].[Products].[Product name]</expression>
</dataItem>
<dataItem aggregate="total" name="Quantity">
<expression>[gosales_goretailers].[Orders].[Quantity]</expression>
</dataItem>
</selection>
</query>
</queries>
<layouts>
...
</layouts>
</report>
Notes About the Query Portion of the Report
- You must define the
name
attribute on thequery
element. The value of thename
attribute must be unique. The query name is used to relate the layout portion of the report to the query portion. - The query must contain a
dataItem
element for each data item. - The
dataItem
elements must be unique within each query.Use the
name
attribute to specify a name for eachdataItem
. This list report queries the data items Product name and Quantity. - Add an
expression
element to thedataItem
element.In its simplest form, an expression is a reference to a query item in the model, and must appear in the format [
namespace].[query_subject].[query_item].
- Add an
aggregate
attribute to each data item.In this sample, Product name is not a column that you want to summarize, and so the
aggregate
attribute is set tonone
. Because you want to know the total quantity ordered for each product, theaggregate
attribute for Quantity is set tototal
. For more information about aggregates, see Summarize Data. - In this report, the values that appear under the Quantity column
represent the total quantity ordered for each product.
This summarization occurs by default because the
selection
element has anautoSummary
attribute that defaults totrue
.