If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

[Solved] Display parameter

Started by otsizh, 24 Oct 2005 12:50:28 PM

Previous topic - Next topic

otsizh

hello,

I have year prompt which is displying years: 2003, 2004, 2005, 2006, 2007, ...
On the report I have to display two years the selected one and the next year.
For example the selected year is 2005, so I have to display 2005 and 2006.

I use text Item and in Report Expression I put: ParamDisplayValue("Year")Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  ( for-2005 )
for the year 2006 I tried ParamDisplayValue("Year")+1 but it did not work.

Thank you for any suggestions.

sir_jeroen

Here's the code.

Btw.. Make sure that "delete unreferenced query objects" under  "tools -> options" is not selected.
It's based on GO Sales and Retailers

<report xml:lang="en" xmlns="http://developer.cognos.com/schemas/report/1/"><!--RS:1.1-->
<modelConnection name="/content/package[@name='GO Sales and Retailers']/model[@name='model']"/>
<querySet xml:lang="en">
<BIQuery name="Query1">
<cube><factList><item refItem="Product line" aggregate="none"/><item refItem="Year" aggregate="none"/><item refItem="Year + 1" aggregate="none"/></factList></cube>
<tabularModel><dataItem name="Product line" aggregate="none"><expression>[gosales_goretailers].[Products].[Product line]</expression></dataItem><dataItem name="Year"><expression>?Year?</expression></dataItem><dataItem name="Year + 1"><expression>?Year? +1</expression></dataItem></tabularModel></BIQuery>
</querySet>
<layoutList>
<layout>

<pageSet>

<page name="Page1">
<pageBody>
<list refQuery="Query1">
<listColumnTitles><listColumnTitle><textItem><queryItemRef refItem="Year" content="label"/></textItem></listColumnTitle><listColumnTitle><textItem><queryItemRef refItem="Product line" content="label"/></textItem></listColumnTitle></listColumnTitles>
<listColumns><listColumn><textItem><queryItemRef refItem="Year"/></textItem><style><CSS value="text-align:right"/></style></listColumn><listColumn><textItem><queryItemRef refItem="Product line"/></textItem></listColumn></listColumns>
<style>
<CSS value="border-collapse:collapse"/>
</style>
</list>
<textItem><expression>[Year + 1]</expression></textItem></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>

otsizh

I am sorry, but could you explain how to do this in steps.
I do not really know how to use this code.

thanks, olha

sir_jeroen

Ok..
Step 1: Add calculation [Year]=> Expression = "?Year?"
Step 2: Add calculation [Year + 1]=> Expression = "?Year?+1"
Step 3: Add calculation [Year - Year+1] => Expression = "cast([Year] as varchar(50)) + ' - ' +cast([Year + 1] as varchar(50))"
Step 4: Add textitem => REPORTexpression = [Year - Year+1]

That's it

otsizh

thanks,
but the years that i have are not calculations, they are prompt parameters and first year depends on the selection that was made.

sir_jeroen

As you look into step 1: ?Year? is a parameter which has to be entered. So it should work in your case.. Buy have you run my example report. Try it and you'll see that it works.

otsizh

thanks a lot, it is working perfect,
sorry for not understanding...

sir_jeroen

No problem... Have fun ReportNetting :D