XML - Managing Data Exchange/Business Intelligence and XML

< XML - Managing Data Exchange



XML - Managing Data Exchange
Chapters
Appendices
Exercises
Related Topics
Computer Science Home
Library and Information Science Home
Markup Languages
Get Involved
To do list
Contributors list
Contributing to Wikibooks
Previous Chapter Next Chapter
Namespace Converting MySQL to XML



Learning objectives

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

Introduction

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 Flow

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 Structure

A report specification consists of four main sections.

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:

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

</pre>


The query section includes information about:


Add pages to a report specification:


Add layout objects to a report:


Specify styles for layout objects:


Add Variables to a Report:

       <variableList>
        <variable name=”Variable1” type=”locale”>
         <expression>ReportLocale()</expression>
          <variableValueList>
           <variableValue value=”fr”/>
          </varialeValueList>
         </variable>
        </variableList>
</pre>


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/">
	<!--RS:1.1-->
	<modelConnection name="/content/package[@name='GSR']/model[@name='model']"/>
	<querySet xml:lang="en-us">
		<BIQuery name="Query1">
			<cube>
				<factList>
					<item refItem="Country" aggregate="none"/>
					<item refItem="First name" aggregate="none"/>
					<item refItem="Last name" aggregate="none"/>
				</factList>
			</cube>
			<tabularModel>
				<dataItem name="Country" aggregate="none">
					<expression>[gsrs].[addr].[Country]</expression>
				</dataItem>
				<dataItem name="First name" aggregate="none">
					<expression>[gsrs].[Person].[First name]</expression>
				</dataItem>
				<dataItem name="Last name" aggregate="none">
					<expression>[gsrs].[Person].[Last name]</expression>
				</dataItem>
				<filter>
					<condition>[gsrs].[addr].[Country]='Germany'</condition>
				</filter>
			</tabularModel>
		</BIQuery>
	</querySet>
	<layoutList>
		<layout>
			<pageSet>
				<page name="Page1">
					<pageBody>
						<list refQuery="Query1">
							<listColumnTitles>
								<listColumnTitle>
									<textItem>
										<queryItemRef refItem="Country" content="label"/>
									</textItem>
								</listColumnTitle>
								<listColumnTitle>
									<textItem>
										<queryItemRef refItem="First name" content="label"/>
									</textItem>
								</listColumnTitle>
								<listColumnTitle>
									<textItem>
										<queryItemRef refItem="Last name" content="label"/>
									</textItem>
								</listColumnTitle>
							</listColumnTitles>
							<listColumns>
								<listColumn>
									<textItem>
										<queryItemRef refItem="Country"/>
									</textItem>
								</listColumn>
								<listColumn>
									<textItem>
										<queryItemRef refItem="First name"/>
									</textItem>
								</listColumn>
								<listColumn>
									<textItem>
										<queryItemRef refItem="Last name"/>
									</textItem>
								</listColumn>
							</listColumns>
							<style>
								<CSS value="border-collapse:collapse"/>
							</style>
							<XMLAttribute name="RS_ListGroupInfo" value=""/>
						</list>
					</pageBody>
					<pageHeader>
						<block class="reportTitle">
							<textItem class="reportTitleText">
								<text/>
							</textItem>
						</block>
						<style>
							<CSS value="padding-bottom:10px"/>
						</style>
					</pageHeader>
					<pageFooter>
						<table>
							<tableRow>
								<tableCell>
									<textItem>
										<expression>AsOfDate()</expression>
									</textItem>
									<style>
										<CSS value="vertical-align:top;text-align:left;width:25%"/>
									</style>
								</tableCell>
								<tableCell>
									<textItem>
										<text>- </text>
									</textItem>
									<textItem>
										<expression>PageNumber()</expression>
									</textItem>
									<textItem>
										<text> -</text>
									</textItem>
									<style>
										<CSS value="vertical-align:top;text-align:center;width:50%"/>
									</style>
								</tableCell>
								<tableCell>
									<textItem>
										<expression>AsOfTime()</expression>
									</textItem>
									<style>
										<CSS value="vertical-align:top;text-align:right;width:25%"/>
									</style>
								</tableCell>
							</tableRow>
							<style>
								<CSS value="border-collapse:collapse;width:100%"/>
							</style>
						</table>
						<style>
							<CSS value="padding-top:10px"/>
						</style>
					</pageFooter>
				</page>
			</pageSet>
		</layout>
	</layoutList>
</report>

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


Exercise

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

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.