Layout Portion of the List Report Sample

The layout portion of the report defines how the data appears in the report.

The following is the XML for the layout portion of the 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>
  ...
 </queries>
 <layouts>
  <layout>
   <reportPages>
    <page name="Page1">
     <pageBody>
      <contents>
       <list name="List1" refQuery="Query1">
        <style>
         <CSS value="border-collapse:collapse"/>
         <defaultStyles>
          <defaultStyle refStyle="ls"/>
         </defaultStyles>
        </style>
        <listColumns>
         <listColumn>
          <listColumnTitle>
           <contents>
            <textItem>
             <dataSource>
              <dataItemLabel refDataItem="Product name"/>
             </dataSource>
            </textItem>
           </contents>
           <style>
            <defaultStyles>
             <defaultStyle refStyle="lt"/>
            </defaultStyles>
           </style>
          </listColumnTitle>
          <listColumnBody>
           <contents>
            <textItem>
             <dataSource>
              <dataItemValue refDataItem="Product name"/>
             </dataSource>
            </textItem>
           </contents>
           <style>
            <defaultStyles>
             <defaultStyle refStyle="lc"/>
            </defaultStyles>
           </style>
          </listColumnBody>
         </listColumn>
         <listColumn>
          <listColumnTitle>
           <contents>
            <textItem>
             <dataSource>
              <dataItemLabel refDataItem="Quantity"/>
             </dataSource>
            </textItem>
           </contents>
           <style>
            <defaultStyles>
             <defaultStyle refStyle="lt"/>
            </defaultStyles>
           </style>
          </listColumnTitle>
          <listColumnBody>
           <contents>
            <textItem>
             <dataSource>
              <dataItemValue refDataItem="Quantity"/>
             </dataSource>
            </textItem>
           </contents>
           <style>
            <defaultStyles>
             <defaultStyle refStyle="lm"/>
            </defaultStyles>
           </style>
          </listColumnBody>
         </listColumn>
        </listColumns>
       </list>
      </contents>
      <style>
       <defaultStyles>
        <defaultStyle refStyle="pb"/>
       </defaultStyles>
      </style>
     </pageBody>
     <style>
      <defaultStyles>
       <defaultStyle refStyle="pg"/>
      </defaultStyles>
     </style>
    </page>
   </reportPages>
  </layout>
 </layouts>
 </report>

Notes About the Layout Elements in a List Report

  • The list element defines the appearance of the list in the report.

    Add the refQuery attribute to the list element to identify the query that contains the data items that you reference in the list. The value of the refQuery attribute must match the value of the name attribute of the query element.

  • The listColumn element defines a column in the list. Each column contains a title and a body represented by the listColumnTitle and listColumnBody elements.
  • The contents element defines the contents of a number of layout elements.
  • The textItem element defines text in a report. For example, in this sample, this element is used in the listColumnBody and listColumnTitle elements.
  • The dataSource element defines the source for the text in the textItem element. The dataSource element can have a dataItemValue or a dataItemLabel child element.

    If you use the dataItemValue element, the text item contains values from the column of data represented by the data item. If you use the dataItemLabel element, the text item contains the label of the data item.

    The value of the refDataItem attribute must match the value of the name attribute of a dataItem element from the query.