XML - Managing Data Exchange/Business Intelligence and XML

From Wikibooks, open books for an open world
< XML - Managing Data Exchange
Jump to: navigation, search



Xml book cover wiki.png 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[edit]

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

Introduction[edit]

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[edit]

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[edit]

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;


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


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[edit]

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

Answers[edit]