Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ReportNet->Report Studio->Bugs->Layout Calculations 2

Status
Not open for further replies.

Nuffsaid

Technical User
Aug 3, 2001
374
CA
Hi All,

So here’s the situation, I’ve created a couple of scheduled monthly reports that run on the 5th of the current month that return information for the previous month. What I’m trying to accomplish is to display the month and year in the report page header. When I add a Layout Calculation to the page header, that simply captures the month and year Data Items I’ve added to the query, the report won’t validate. However, this problem seems to be intermediate. Sometimes it works, sometimes not.

To demonstrate this problem I’ve posted a sample report based on the Go_Sales_Go_Retailers sample below.

I’ve been told by Cognos support that this is a known issue in Report Net -> Report Studio.

What I would like is for someone who has the Cognos samples installed to try this and let us know what the results are.

Your task is to display the [Order Year] Fact Data Item from Query 1 in the header section of the report.

So here's the report...... Good Luck!!!!
Code:
<report xml:lang="en-ca" xmlns="[URL unfurl="true"]http://developer.cognos.com/schemas/report/1/"><!--RS:1.1-->[/URL]
	<modelConnection name="/content/package[@name='GO Sales and Retailers']/model[@name='model']"/>
	<querySet xml:lang="en-ca">
		<BIQuery name="Query1">
			<cube><dimension name="Retailer name"><level name="Retailer name"><item key="true" refItem="Retailer name" aggregate="none" isHeader="true"/></level></dimension><dimension name="Product line"><level name="Product line"><item key="true" refItem="Product line" aggregate="none" isHeader="true"/></level><level name="Product type"><item key="true" refItem="Product type" aggregate="none" isHeader="true"/></level></dimension><factList><item refItem="Revenue" aggregate="automatic" isHeader="true"/><item refItem="Order year" aggregate="none"/></factList></cube>
		<tabularModel><dataItem name="Retailer name" aggregate="none"><expression>[gosales_goretailers].[Orders].[Retailer name]</expression></dataItem><dataItem name="Product line" aggregate="none"><expression>[gosales_goretailers].[Products].[Product line]</expression></dataItem><dataItem name="Product type" aggregate="none"><expression>[gosales_goretailers].[Products].[Product type]</expression></dataItem><dataItem name="Revenue" aggregate="total"><expression>[gosales_goretailers].[Orders].[Revenue]</expression></dataItem><filter use="required" summary="false"><condition>[gosales_goretailers].[Orders].[Order year]=2006</condition></filter><dataItem name="Order year" aggregate="none"><expression>[gosales_goretailers].[Orders].[Order year]</expression></dataItem></tabularModel></BIQuery>
		
	<BIQuery name="Query1_crosstab"><cubeReference refQuery="Query1"/><summary><rowEdge><level refLevel="Retailer name"><item refItem="Retailer name"/></level></rowEdge><columnEdge><level refLevel="Product line"><item refItem="Product line"/></level><level refLevel="Product type"><item refItem="Product type"/></level></columnEdge><dataCells><item refItem="Revenue"/></dataCells></summary></BIQuery></querySet>
	<layoutList>
		<layout>
			
		<pageSet>
				
			<page name="Page1">
					<pageBody>
						<crosstab refQuery="Query1_crosstab">
							<style>
								<CSS value="border-collapse:collapse"/>
							</style>
							<crosstabCorner/>
							<crosstabRows/>
							<crosstabColumns/>
						<crosstabLevel refLevel="Retailer name"><textItem><queryItemRef refItem="Retailer name"/></textItem></crosstabLevel><crosstabLevel refLevel="Product line"><textItem><queryItemRef refItem="Product line"/></textItem></crosstabLevel><crosstabLevel refLevel="Product type"><textItem><queryItemRef refItem="Product type"/></textItem></crosstabLevel><crosstabCell><textItem><queryItemRef refItem="Revenue"/></textItem><member refMember="Revenue"/></crosstabCell></crosstab>
					</pageBody>
					<pageHeader>
						<block class="reportTitle">
							
						<textItem><text>DISPLAY: QUERY ITEMS -&gt;FACTS -&gt;ORDER YEAR: HERE</text><style><CSS value="color:red"/></style></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>


So, my question is, does anybody have a work around? How do you display dates?


Nuffsaid.
 
What if you associate the PAGE with the Query1 , then you can drag and drop the Order_Year to the Header.

I don't have the Go sales package but I have modified your report to be as described above.

Code:
<report xml:lang="en-ca" xmlns="[URL unfurl="true"]http://developer.cognos.com/schemas/report/1/"><!--RS:1.1-->[/URL]
    <modelConnection name="/content/package[@name='GO Sales and Retailers']/model[@name='model']"/>
    <querySet xml:lang="en-ca">
        <BIQuery name="Query1">
            <cube><dimension name="Retailer name"><level name="Retailer name"><item key="true" refItem="Retailer name" aggregate="none" isHeader="true"/></level></dimension><dimension name="Product line"><level name="Product line"><item key="true" refItem="Product line" aggregate="none" isHeader="true"/></level><level name="Product type"><item key="true" refItem="Product type" aggregate="none" isHeader="true"/></level></dimension><factList><item refItem="Revenue" aggregate="automatic" isHeader="true"/><item refItem="Order year" aggregate="none" isHeader="true"/></factList></cube>
        <tabularModel><dataItem name="Retailer name" aggregate="none"><expression>[gosales_goretailers].[Orders].[Retailer name]</expression></dataItem><dataItem name="Product line" aggregate="none"><expression>[gosales_goretailers].[Products].[Product line]</expression></dataItem><dataItem name="Product type" aggregate="none"><expression>[gosales_goretailers].[Products].[Product type]</expression></dataItem><dataItem name="Revenue" aggregate="total"><expression>[gosales_goretailers].[Orders].[Revenue]</expression></dataItem><filter use="required" summary="false"><condition>[gosales_goretailers].[Orders].[Order year]=2006</condition></filter><dataItem name="Order year" aggregate="none"><expression>[gosales_goretailers].[Orders].[Order year]</expression></dataItem></tabularModel></BIQuery>
        
    <BIQuery name="Query1_crosstab"><cubeReference refQuery="Query1"/><summary><rowEdge><level refLevel="Retailer name"><item refItem="Retailer name"/></level></rowEdge><columnEdge><level refLevel="Product line"><item refItem="Product line"/></level><level refLevel="Product type"><item refItem="Product type"/></level></columnEdge><dataCells><item refItem="Revenue"/></dataCells></summary></BIQuery></querySet>
    <layoutList>
        <layout>
            
        <pageSet>
                
            <page name="Page1" refQuery="Query1">
                    <pageBody>
                        <crosstab refQuery="Query1_crosstab">
                            <style>
                                <CSS value="border-collapse:collapse"/>
                            </style>
                            <crosstabCorner/>
                            <crosstabRows/>
                            <crosstabColumns/>
                        <crosstabLevel refLevel="Retailer name"><textItem><queryItemRef refItem="Retailer name"/></textItem></crosstabLevel><crosstabLevel refLevel="Product line"><textItem><queryItemRef refItem="Product line"/></textItem></crosstabLevel><crosstabLevel refLevel="Product type"><textItem><queryItemRef refItem="Product type"/></textItem></crosstabLevel><crosstabCell><textItem><queryItemRef refItem="Revenue"/></textItem><member refMember="Revenue"/></crosstabCell></crosstab>
                    </pageBody>
                    <pageHeader>
                        <block class="reportTitle">
                            
                        <textItem><queryItemRef refItem="Order year"/></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>
 
Hi Draoued,

Thanks for the reply. I tried your suggestion, however the report won't validate. "RSV-RND-0053 Unable to find the item 'Order year' in the query 'Query1'." Cognos has this logged under their problem number 489137. This seems to be an issue in MR1 and MR2 but not MR3 (or so I'm told.) This is really frustrating to say the least. What good is a report that can't display the period it covers?? And it's my understanding that there's no fix. Grrrrr.

If anybody has some type of work around, I would sure like to hear from ya....

Nuffsaid.
 
Try this:

Code:
<report xml:lang="en-ca" xmlns="[URL unfurl="true"]http://developer.cognos.com/schemas/report/1/"><!--RS:1.1-->[/URL]
    <modelConnection name="/content/package[@name='GO Sales and Retailers']/model[@name='model']"/>
    <querySet xml:lang="en-ca">
        <BIQuery name="Report Query">
            <cube><dimension name="Retailer name"><level name="Retailer name"><item key="true" refItem="Retailer name" aggregate="none" isHeader="true"/></level><level name="Order year"><item refItem="Order year" aggregate="none" key="true" isHeader="true"/></level></dimension><dimension name="Product line"><level name="Product line"><item key="true" refItem="Product line" aggregate="none" isHeader="true"/></level><level name="Product type"><item key="true" refItem="Product type" aggregate="none" isHeader="true"/></level></dimension><factList><item refItem="Revenue" aggregate="automatic" isHeader="true"/></factList></cube>
        <tabularModel><dataItem name="Retailer name" aggregate="none"><expression>[gosales_goretailers].[Orders].[Retailer name]</expression></dataItem><dataItem name="Product line" aggregate="none"><expression>[gosales_goretailers].[Products].[Product line]</expression></dataItem><dataItem name="Product type" aggregate="none"><expression>[gosales_goretailers].[Products].[Product type]</expression></dataItem><dataItem name="Revenue" aggregate="total"><expression>[gosales_goretailers].[Orders].[Revenue]</expression></dataItem><filter><condition>[gosales_goretailers].[Orders].[Order year] = ?Parameter1?</condition></filter><dataItem name="Order year" aggregate="none"><expression>[gosales_goretailers].[Orders].[Order year]</expression></dataItem></tabularModel></BIQuery>
        
    <BIQuery name="Prompt Query"><cube><factList><item refItem="Order year" aggregate="none" isHeader="true"/></factList></cube><tabularModel><dataItem name="Order year" aggregate="none"><expression>[gosales_goretailers].[Orders].[Order year]</expression></dataItem></tabularModel></BIQuery><BIQuery name="Report Query_crosstab"><cubeReference refQuery="Report Query"/><summary><rowEdge><level refLevel="Retailer name"><item refItem="Retailer name"/></level><level refLevel="Order year"><item refItem="Order year"/></level></rowEdge><columnEdge><level refLevel="Product line"><item refItem="Product line"/></level><level refLevel="Product type"><item refItem="Product type"/></level></columnEdge><dataCells><item refItem="Revenue"/></dataCells></summary></BIQuery></querySet>
    <layoutList>
        <layout>
            
        <promptPageList><page name="Prompt Page1">
					<pageHeader>
						<block class="reportTitle">
							<textItem class="reportTitleText">
								<text/>
							</textItem>
						</block>
						<style>
							<CSS value="padding-bottom:10px"/>
						</style>
					</pageHeader>
					<pageBody>
						<style>
							<CSS value="padding:12px"/>
						</style>
					<selectValue parameter="Parameter1" refQuery="Prompt Query" multiSelect="false" selectUI="dropdown" required="true"><useItem refItem="Order year"/><displayItem refItem="Order year"/></selectValue>
					</pageBody>
					<pageFooter>
						<style>
							<CSS value="padding:12px;border-top:1pt solid #999999"/>
						</style>
						<promptButton type="cancel">
							<style>
								<CSS value="margin-right:7px"/>
							</style>
						</promptButton>
						<promptButton type="back">
							<style>
								<CSS value="margin-right:7px"/>
							</style>
						</promptButton>
						<promptButton type="next">
							<style>
								<CSS value="margin-right:7px"/>
							</style>
						</promptButton>
						<promptButton type="finish"/>
					</pageFooter>
				</page>
			</promptPageList><pageSet>
                
            <page name="Page1" refQuery="Report Query">
                    <pageBody>
                        <crosstab refQuery="Report Query_crosstab">
                            <style>
                                <CSS value="border-collapse:collapse"/>
                            </style>
                            <crosstabCorner/>
                            <crosstabRows/>
                            <crosstabColumns/>
                        <crosstabLevel refLevel="Retailer name"><textItem><queryItemRef refItem="Retailer name"/></textItem></crosstabLevel><crosstabLevel refLevel="Order year" class="none"/><crosstabLevel refLevel="Product line"><textItem><queryItemRef refItem="Product line"/></textItem></crosstabLevel><crosstabLevel refLevel="Product type"><textItem><queryItemRef refItem="Product type"/></textItem></crosstabLevel><crosstabCell><textItem><queryItemRef refItem="Revenue"/></textItem><member refMember="Revenue"/></crosstabCell></crosstab>
                    </pageBody>
                    
                    
                <pageHeader><block>
						<textItem><text>This is the header of the report and this is the year: </text></textItem><textItem><queryItemRef refItem="Order year"/></textItem></block>
					</pageHeader></page></pageSet></layout>
    </layoutList>
</report>
 
Hi King Crab,

Thanks for your reply. Your report validates however I don’t want to prompt for dates. I want to schedule on a recurring monthly basis with no user intervention. In order to do so I need to use something like the following as my filter;

Code:
[gosales_goretailers].[Orders].[Order year] = extract(year,{sysdate})
and
[gosales_goretailers].[Orders].[Order month] = to_char({sysdate},'MM')-1

An interesting observation though, while I was messing with your report I started out just replacing your filter, which prompts for the year, with the code above and the report validated!!

Started to get excited…..[flip] short lived however. When I removed your prompt query (and prompt page) the report would no longer validate.[banghead] Bizarre.

In my mind this “bug” really limits Report Net’s scheduling ability. Any other thoughts??


Nuffsaid.
 
I have dealt with this by inserting a new list with the Order Year and any necessary filters applied. Then Cut Order year so you have an empty list (this won't appear when run). Apply this query to the page in the Page properties, then drag the query item to the header.

Try This:

<report xml:lang="en-ca" xmlns=" <modelConnection name="/content/package[@name='GO Sales and Retailers']/model[@name='model']"/>
<querySet xml:lang="en-ca">
<BIQuery name="Query1">
<cube><dimension name="Retailer name"><level name="Retailer name"><item key="true" refItem="Retailer name" aggregate="none" isHeader="true"/></level></dimension><dimension name="Product line"><level name="Product line"><item key="true" refItem="Product line" aggregate="none" isHeader="true"/></level><level name="Product type"><item key="true" refItem="Product type" aggregate="none" isHeader="true"/></level></dimension><factList><item refItem="Revenue" aggregate="automatic" isHeader="true"/></factList></cube>
<tabularModel><dataItem name="Retailer name" aggregate="none"><expression>[gosales_goretailers].[Orders].[Retailer name]</expression></dataItem><dataItem name="Product line" aggregate="none"><expression>[gosales_goretailers].[Products].[Product line]</expression></dataItem><dataItem name="Product type" aggregate="none"><expression>[gosales_goretailers].[Products].[Product type]</expression></dataItem><dataItem name="Revenue" aggregate="total"><expression>[gosales_goretailers].[Orders].[Revenue]</expression></dataItem><filter use="required" summary="false"><condition>[gosales_goretailers].[Orders].[Order year]=2006</condition></filter></tabularModel></BIQuery>

<BIQuery name="Order Year">
<cube><dimension name="Order year1"><level name="Order year1"><item aggregate="none" refItem="Order year1" key="true" isHeader="true"/></level></dimension></cube>
<tabularModel><filter use="required" summary="false"><condition>[gosales_goretailers].[Orders].[Order year]=2006</condition></filter><dataItem name="Order year" aggregate="none"><expression>[gosales_goretailers].[Orders].[Order year]</expression></dataItem><dataItem name="Order year1" aggregate="none"><expression>[gosales_goretailers].[Orders].[Order year]</expression></dataItem></tabularModel></BIQuery><BIQuery name="Query1_crosstab"><cubeReference refQuery="Query1"/><summary><rowEdge><level refLevel="Retailer name"><item refItem="Retailer name"/></level></rowEdge><columnEdge><level refLevel="Product line"><item refItem="Product line"/></level><level refLevel="Product type"><item refItem="Product type"/></level></columnEdge><dataCells><item refItem="Revenue"/></dataCells></summary></BIQuery></querySet>
<layoutList>
<layout>

<pageSet>

<page name="Page1" refQuery="Order Year">
<pageBody>
<crosstab refQuery="Query1_crosstab">
<style>
<CSS value="border-collapse:collapse"/>
</style>
<crosstabCorner/>
<crosstabRows/>
<crosstabColumns/>
<crosstabLevel refLevel="Retailer name"><textItem><queryItemRef refItem="Retailer name"/></textItem></crosstabLevel><crosstabLevel refLevel="Product line"><textItem><queryItemRef refItem="Product line"/></textItem></crosstabLevel><crosstabLevel refLevel="Product type"><textItem><queryItemRef refItem="Product type"/></textItem></crosstabLevel><crosstabCell><textItem><queryItemRef refItem="Revenue"/></textItem><member refMember="Revenue"/></crosstabCell></crosstab>
<block/>
<block><list refQuery="Order Year">
<listColumnTitles/>
<listColumns/>
<style>
<CSS value="border-collapse:collapse"/>
</style>
<XMLAttribute name="RS_ListGroupInfo" value="Order year1"/></list>
</block>
</pageBody>
<pageHeader>
<block class="reportTitle">

<textItem><text>DISPLAY: QUERY ITEMS -&gt;FACTS -&gt;ORDER YEAR:</text><style><CSS value="color:red"/></style></textItem><textItem><queryItemRef refItem="Order year1"/></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>
 
Hi

I would do something like the spec posted below.

By using a Query ref, I reuse the settings made in the original query and group it by order year. Finally I put in a list in the heade showing only the order year.

Regards,

Søren

Code:
<report xml:lang="en-ca" xmlns="[URL unfurl="true"]http://developer.cognos.com/schemas/report/1/"><!--RS:1.1-->[/URL]
    <modelConnection name="/content/package[@name='GO Sales and Retailers']/model[@name='model']"/>
    <querySet xml:lang="en-ca">
        <BIQuery name="Query1">
            <cube><dimension name="Retailer name"><level name="Retailer name"><item key="true" refItem="Retailer name" aggregate="none" isHeader="true"/></level></dimension><dimension name="Product line"><level name="Product line"><item key="true" refItem="Product line" aggregate="none" isHeader="true"/></level><level name="Product type"><item key="true" refItem="Product type" aggregate="none" isHeader="true"/></level></dimension><factList><item refItem="Revenue" aggregate="automatic" isHeader="true"/><item refItem="Order year" aggregate="none"/></factList></cube>
        <tabularModel><dataItem name="Retailer name" aggregate="none"><expression>[gosales_goretailers].[Orders].[Retailer name]</expression></dataItem><dataItem name="Product line" aggregate="none"><expression>[gosales_goretailers].[Products].[Product line]</expression></dataItem><dataItem name="Product type" aggregate="none"><expression>[gosales_goretailers].[Products].[Product type]</expression></dataItem><dataItem name="Revenue" aggregate="total"><expression>[gosales_goretailers].[Orders].[Revenue]</expression></dataItem><filter use="required" summary="false"><condition>[gosales_goretailers].[Orders].[Order year]=2006</condition></filter><dataItem name="Order year" aggregate="none"><expression>[gosales_goretailers].[Orders].[Order year]</expression></dataItem></tabularModel></BIQuery>
        
    <BIQuery name="Query2"><cube><dimension name="Order year"><level name="Order year"><item aggregate="maximum" refItem="Order year" key="true"/></level></dimension></cube><tabularReference refQuery="Query1"/></BIQuery><BIQuery name="Query1_crosstab"><cubeReference refQuery="Query1"/><summary><rowEdge><level refLevel="Retailer name"><item refItem="Retailer name"/></level></rowEdge><columnEdge><level refLevel="Product line"><item refItem="Product line"/></level><level refLevel="Product type"><item refItem="Product type"/></level></columnEdge><dataCells><item refItem="Revenue"/></dataCells></summary></BIQuery></querySet>
    <layoutList>
        <layout>
            
        <pageSet>
                
            <page name="Page1" refQuery="Query2">
                    <pageBody>
                        <crosstab refQuery="Query1_crosstab">
                            <style>
                                <CSS value="border-collapse:collapse"/>
                            </style>
                            <crosstabCorner/>
                            <crosstabRows/>
                            <crosstabColumns/>
                        <crosstabLevel refLevel="Retailer name"><textItem><queryItemRef refItem="Retailer name"/></textItem></crosstabLevel><crosstabLevel refLevel="Product line"><textItem><queryItemRef refItem="Product line"/></textItem></crosstabLevel><crosstabLevel refLevel="Product type"><textItem><queryItemRef refItem="Product type"/></textItem></crosstabLevel><crosstabCell><textItem><queryItemRef refItem="Revenue"/></textItem><member refMember="Revenue"/></crosstabCell></crosstab>
                    </pageBody>
                    <pageHeader>
                        <block class="reportTitle">
                            
                        <textItem><text>DISPLAY: QUERY ITEMS -&gt;FACTS -&gt;ORDER YEAR: HERE</text><style><CSS value="color:red"/></style></textItem><list refQuery="Query2" showColumnTitles="hide">
								<listColumnTitles><listColumnTitle><textItem><text>Order year</text></textItem></listColumnTitle></listColumnTitles>
								<listColumns><listColumn><textItem><queryItemRef refItem="Order year"/></textItem><style><CSS value="border-top-style:none;border-left-style:none;border-bottom-style:none;border-right-style:none"/></style></listColumn></listColumns>
								<style>
									<CSS value="border-collapse:collapse"/>
								</style>
								<XMLAttribute name="RS_ListGroupInfo" value="Order year"/></list>
						</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>
 
Hi Guys,

Interesting, although both DataVixen and CognosCons have a similar approach, I like some of the ideas from both solutions.

Because I want to display the month along with the year in the page header (and possibly some other text) I don’t think placing the actual list report in the header is the way to go, so I went with DataVixen’s idea of leaving a blank list at the bottom of the report. (Interesting that if you try to cut the blank report out, the solution won’t work.)

However I did employ Cognos Cons’s suggestion of using a tabular reference, one less tabular model to maintain.

The only caveat I can see, is that if you run the report in HTML format and you have to “Page Down”, the dates won’t appear on subsequent pages. It seems to run fine in PDF if the report spans multiple pages however.

So, although not 100 % perfect, *’s for you both!

For those of you interested in the final report I’ve posted the code below.

Thanks much……..

Code:
<report xml:lang="en-ca" xmlns="[URL unfurl="true"]http://developer.cognos.com/schemas/report/1/"><!--RS:1.1-->[/URL]
    <modelConnection name="/content/package[@name='GO Sales and Retailers']/model[@name='model']"/>
    <querySet xml:lang="en-ca">
        <BIQuery name="Query1">
            <cube><dimension name="Retailer name"><level name="Retailer name"><item key="true" refItem="Retailer name" aggregate="none" isHeader="true"/></level></dimension><dimension name="Product line"><level name="Product line"><item key="true" refItem="Product line" aggregate="none" isHeader="true"/></level><level name="Product type"><item key="true" refItem="Product type" aggregate="none" isHeader="true"/></level></dimension><factList><item refItem="Revenue" aggregate="automatic" isHeader="true"/><item refItem="Order year" aggregate="none"/></factList></cube>
        <tabularModel><dataItem name="Retailer name" aggregate="none"><expression>[gosales_goretailers].[Orders].[Retailer name]</expression></dataItem><dataItem name="Product line" aggregate="none"><expression>[gosales_goretailers].[Products].[Product line]</expression></dataItem><dataItem name="Product type" aggregate="none"><expression>[gosales_goretailers].[Products].[Product type]</expression></dataItem><dataItem name="Revenue" aggregate="total"><expression>[gosales_goretailers].[Orders].[Revenue]</expression></dataItem><filter use="required" summary="false"><condition>[gosales_goretailers].[Orders].[Order year] = extract(year,{sysdate})
and
[gosales_goretailers].[Orders].[Order month] = to_char({sysdate},'MM')-1

</condition></filter><dataItem name="Order year" aggregate="none"><expression>[gosales_goretailers].[Orders].[Order year]</expression></dataItem><dataItem name="Order month" aggregate="none"><expression>[gosales_goretailers].[Orders].[Order month]</expression></dataItem><dataItem name="Month Display"><expression>(  CASE [Order month] 
WHEN  1 THEN 'January'
WHEN  2 THEN 'February'
WHEN  3 THEN 'March'
WHEN  4 THEN 'April'
WHEN  5 THEN 'May'
WHEN  6 THEN 'June'
WHEN  7 THEN 'July'
WHEN  8 THEN 'August'
WHEN  9 THEN 'September'
WHEN  10 THEN 'October'
WHEN  11 THEN 'November'
ELSE  'December'
END )</expression></dataItem></tabularModel></BIQuery>
        
    <BIQuery name="Query2"><cube><dimension name="Order year"><level name="Order year"><item aggregate="none" refItem="Order year" key="true" isHeader="true"/></level><level name="Month Display"><item aggregate="none" refItem="Month Display" key="true" isHeader="true"/></level></dimension></cube><tabularReference refQuery="Query1"/></BIQuery><BIQuery name="Query1_crosstab"><cubeReference refQuery="Query1"/><summary><rowEdge><level refLevel="Retailer name"><item refItem="Retailer name"/></level></rowEdge><columnEdge><level refLevel="Product line"><item refItem="Product line"/></level><level refLevel="Product type"><item refItem="Product type"/></level></columnEdge><dataCells><item refItem="Revenue"/></dataCells></summary></BIQuery></querySet>
    <layoutList>
        <layout>
            
        <pageSet>
                
            <page name="Page1" refQuery="Query2">
                    <pageBody>
                        <crosstab refQuery="Query1_crosstab">
                            <style>
                                <CSS value="border-collapse:collapse"/>
                            </style>
                            <crosstabCorner/>
                            <crosstabRows/>
                            <crosstabColumns/>
                        <crosstabLevel refLevel="Retailer name"><textItem><queryItemRef refItem="Retailer name"/></textItem></crosstabLevel><crosstabLevel refLevel="Product line"><textItem><queryItemRef refItem="Product line"/></textItem></crosstabLevel><crosstabLevel refLevel="Product type"><textItem><queryItemRef refItem="Product type"/></textItem></crosstabLevel><crosstabCell><textItem><queryItemRef refItem="Revenue"/></textItem><member refMember="Revenue"/></crosstabCell></crosstab>
                    <block/>
					<list refQuery="Query2">
							<listColumnTitles/>
							<listColumns/>
							<style>
								<CSS value="border-collapse:collapse"/>
							</style>
							<XMLAttribute name="RS_ListGroupInfo" value="Order year|Month Display"/></list>
					</pageBody>
                    <pageHeader>
                        <block class="reportTitle">
                            
                        <textItem><text>DISPLAY: QUERY ITEMS -&gt;FACTS -&gt;ORDER YEAR:</text><style><CSS value="color:red"/></style></textItem><textItem><queryItemRef refItem="Month Display"/></textItem><textItem><text>  </text></textItem><textItem><queryItemRef refItem="Order year"/></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>

Nuffsaid.
 
If you want the date to appear on each page, set the pagination property of the list that you are using to show the date to "Repeat Every Page"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top