COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: piro299 on 28 Sep 2014 02:25:22 PM

Title: Table Conditional Styles based on a data item from a query - Possible?
Post by: piro299 on 28 Sep 2014 02:25:22 PM
Hello together,

I'm trying to find the correct setting to give a table cell a conditional style based on a data item from a query. I use a Singleton to display the data item in the table cell. See Screenshot.

When the data item is '29' the background of the table cell should be gray. The setting are causing an error.


RSV-VAL-0032
The following expression is not valid: [Query1].[FieldValue] = '29'. If the item exists in a query but is not referenced in the layout, add it to a property list. CRX-API-0005 An error occurred at or near the position '0'. The variable named '[Query1].[FieldValue]' is invalid.


Normally, I would add the data item to the property of the table but it doesn't exist.

Is my plan possible? And what do I have to do?

Here are my report.

<report xmlns="http://developer.cognos.com/schemas/report/11.0/" useStyleVersion="10" expressionLocale="en">
<modelPath>/content/folder[@name=&apos;KielEngineCenter&apos;]/folder[@name=&apos;Packages&apos;]/folder[@name=&apos;CI&apos;]/package[@name=&apos;KEC-CI2-HOST-Pck&apos;]/model[@name=&apos;model&apos;]</modelPath>
<drillBehavior/>
<layouts>
<layout>
<reportPages>
<page name="Page1">
<style>
<defaultStyles>
<defaultStyle refStyle="pg"/>
</defaultStyles>
</style>
<pageBody>
<style>
<defaultStyles>
<defaultStyle refStyle="pb"/>
</defaultStyles>
</style>
<contents><table><style><defaultStyles><defaultStyle refStyle="tb"/></defaultStyles><CSS value="border-collapse:collapse;width:10%;height:50px;border:1pt solid black"/></style><tableRows><tableRow><tableCells><tableCell><contents><singleton refQuery="Query1" name="Singleton1">
<contents><textItem><dataSource><dataItemValue refDataItem="FieldValue"/></dataSource></textItem></contents>
</singleton></contents><style><CSS value="vertical-align:middle;text-align:center"/></style><conditionalStyleRefs><conditionalStyleRef refConditionalStyle="Conditional Style 1"/></conditionalStyleRefs></tableCell></tableCells></tableRow></tableRows></table></contents>
</pageBody>
</page>
</reportPages>
</layout>
</layouts>
<XMLAttributes><XMLAttribute output="no" name="RS_CreateExtendedDataItems" value="true"/><XMLAttribute output="no" name="listSeparator" value=","/><XMLAttribute output="no" name="RS_modelModificationTime" value="2014-09-22T12:00:31.697Z"/></XMLAttributes><queries><query name="Query1">
<source>
<model/>
</source>
<selection><dataItem name="FieldValue"><expression>&apos;29&apos;</expression></dataItem></selection>
</query></queries><namedConditionalStyles><advancedConditionalStyle name="Conditional Style 1"><styleCases><styleCase><reportCondition>[Query1].[FieldValue] = &apos;29&apos;</reportCondition></styleCase></styleCases><styleDefault/></advancedConditionalStyle></namedConditionalStyles><reportName>TableLayout</reportName></report>


Many thanks in advance.

Sven
Title: Re: Table Conditional Styles based on a data item from a query - Possible?
Post by: esar on 29 Sep 2014 11:13:23 AM
Assign the Query1 to the Page (in Page properties)
Title: Re: Table Conditional Styles based on a data item from a query - Possible?
Post by: piro299 on 30 Sep 2014 03:42:05 PM
Good ieea but then the whole page has the style and not only the table cell and this will works only with one query.

Many report is a kind of a calendar with 12 queries for each month. All holidays should be an other background.

That is the reason for my question.

Anybody else with an idea to help me?

Many thanks in advance.
Sven