XML - Managing Data Exchange/Business Intelligence and XML

Previous Chapter Next Chapter
Namespace Converting MySQL to XML

Learning objectivesEdit

Upon completion of this chapter, for a single entity you will be able to

  • create a report specification entirely in XML for Cognos ReportNet
  • update a report specification in XML format.
  • identify four main sections in a report specification


Every report created in Cognos ReportNet has a specification that is written in XML, so you can customize it using XML editor or create a report specification entirely in XML.

Report Specification FlowEdit

After you save a report and open it again, the report specification is pulled from the content store as you can see in Figure 28.1. When you edit it, the changes remain local on the client machine until you save it. When you save the report, the content store is updated.

Figure 28.1 Report Specification Flow

You can see a sample of web report in figure 28.2 and this report can be generated from XML file;

Figure 28.2 Sample of a report

XML in Report Specification StructureEdit

A report specification consists of four main sections.

  • Report Section
    • XML Tag:
      • <report>
      • <modelConnection>
  • Query Section
    • XML Tag:
      • <querySet>
  • Layout Section
    • XML Tag:
      • <layoutList>
  • Variable Section
    • XML Tag:
      • <variableList>

At minimum, a report specification must include the <report></report> tags, as well as authoring language and schema information.

The specification header in Report Section includes information about:

  • authoring language, “en-us” indicates American English. You can use other language than English for the report
  • namespace : http://developer.sample.com/schemas/report/1
  • package name: GSR
  • model version : @name='model'

<report xml:lang="en-us" xmlns="http://developer.sample.com/schemas/report/1/"> <modelConnection name="/content/package[@name='GSR']/model[@name='model']"/>

The query section includes information about:

  • Cube elements are indicated by the <cube></cube> tags which can contain:
    • facts (<factList></factList>. Country, First Name and Last Name are the facts.
    • dimensions (<dimension></dimension>) consisting of levels(<level></level>)
    • filters (<filter></filters> consiting of conditions(<condition></conditions>). Country is the filter for this report, which is equal to Germany.
  • Tabular model is contained in the <tabularModel></tabularModel> tags.
    • Each tabular model contains data items (<dataItem></dataItem>) consisting of fully qualified expressions (<expression></expression>)
  • The query section of a report is contained in the <querySet></querySet>tags.
  • The query section can include multiple queries, each of which is contained in the <BIQuery></BIQuery>tags.

Add pages to a report specification:

  • You can add many pages to a report. Each page is outlined between the <pageSet> </pageSet>tags.
    • Each page can consist of :
      • a body ( mandatory)
      • a header
      • a footer

Add layout objects to a report:

  • Once you have added one or more pages to the report layout, you can add a variety of layout objects, such as :
    • Text items
    • Blocks
    • Lists
    • Charts
    • Crosstabs
    • Tables

Specify styles for layout objects:

  • You can use Cascading Style Sheets (CSS) attributes to determine the look and feel of objects in the layout.
  • CSS values are specified between the <style></style> tags.
  • CSS values can apply to things like font sizes, background colors, and so forth.

Add Variables to a Report:

  • You can specify variables between the <variableList></variableList> tags of the report specification., and each of variable includes an expression between the <expression></expression> tags.
  • We can use Variable 1 that contains a list of possible values, example value: fr for using French language;

        <variable name=”Variable1” type=”locale”>
           <variableValue value=”fr”/>

Below is the complete XML file for the report in Figure 28.3

<report xml:lang="en-us" xmlns="http://developer.sample.com/schemas/report/1/">
	<modelConnection name="/content/package[@name='GSR']/model[@name='model']"/>
	<querySet xml:lang="en-us">
		<BIQuery name="Query1">
					<item refItem="Country" aggregate="none"/>
					<item refItem="First name" aggregate="none"/>
					<item refItem="Last name" aggregate="none"/>
				<dataItem name="Country" aggregate="none">
				<dataItem name="First name" aggregate="none">
					<expression>[gsrs].[Person].[First name]</expression>
				<dataItem name="Last name" aggregate="none">
					<expression>[gsrs].[Person].[Last name]</expression>
				<page name="Page1">
						<list refQuery="Query1">
										<queryItemRef refItem="Country" content="label"/>
										<queryItemRef refItem="First name" content="label"/>
										<queryItemRef refItem="Last name" content="label"/>
										<queryItemRef refItem="Country"/>
										<queryItemRef refItem="First name"/>
										<queryItemRef refItem="Last name"/>
								<CSS value="border-collapse:collapse"/>
							<XMLAttribute name="RS_ListGroupInfo" value=""/>
						<block class="reportTitle">
							<textItem class="reportTitleText">
							<CSS value="padding-bottom:10px"/>
										<CSS value="vertical-align:top;text-align:left;width:25%"/>
										<text>- </text>
										<text> -</text>
										<CSS value="vertical-align:top;text-align:center;width:50%"/>
										<CSS value="vertical-align:top;text-align:right;width:25%"/>
								<CSS value="border-collapse:collapse;width:100%"/>
							<CSS value="padding-top:10px"/>

Section summary: As Report Specification sticks to XML Rules it is favored for creating and updating a markup file


The end user wants to read the report in Japanese language, so you have to add a variable for Japanese language.