Skip to main content



      Home
Home » Archived » BIRT » Alternating colours on table rows.
Alternating colours on table rows. [message #152573] Tue, 11 April 2006 10:48 Go to next message
Eclipse UserFriend
Originally posted by: stuart.roe.ovic.co.uk

I have managed to get colours to alternate on table rows via row[0]%2==0
in highlights. But the evaluation appears to occur at an odd time.

I have a List object bound to a table returning a result set listing
item references. The Highlights of the List object has been configured
to vary the background colour according to row[0]%2.

If I place a Data object to display row["item_ref"] in the List's
Detail, the item_ref is shown and field's background colour varies as
expected.

If I modify the object to be bound to a new data source (using item_ref
as a parameter) and display a data item from the new source, the
required data is returned but the alternating colour stops working. I
suspect that the expression is incorrectly using the row[0] value from
the Data object's result set and not the result set from the List
object, where the expression is defined.

Am I doing something wrong? Is BIRT doing something wrong? Does anyone
have a work around, other than writing my SQL to include the item's name
in the first place?
Re: Alternating colours on table rows. [message #152638 is a reply to message #152573] Tue, 11 April 2006 14:12 Go to previous messageGo to next message
Eclipse UserFriend
Can you post your design file?

Jason

"Stuart Roe" <stuart.roe@ovic.co.uk> wrote in message
news:e1gfkd$th6$1@utils.eclipse.org...
>I have managed to get colours to alternate on table rows via row[0]%2==0 in
>highlights. But the evaluation appears to occur at an odd time.
>
> I have a List object bound to a table returning a result set listing item
> references. The Highlights of the List object has been configured to vary
> the background colour according to row[0]%2.
>
> If I place a Data object to display row["item_ref"] in the List's Detail,
> the item_ref is shown and field's background colour varies as expected.
>
> If I modify the object to be bound to a new data source (using item_ref as
> a parameter) and display a data item from the new source, the required
> data is returned but the alternating colour stops working. I suspect that
> the expression is incorrectly using the row[0] value from the Data
> object's result set and not the result set from the List object, where the
> expression is defined.
>
> Am I doing something wrong? Is BIRT doing something wrong? Does anyone
> have a work around, other than writing my SQL to include the item's name
> in the first place?
Re: Alternating colours on table rows. [message #153174 is a reply to message #152638] Thu, 13 April 2006 03:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stuart.roe.ovic.co.uk

This is a multi-part message in MIME format.
--------------090002070403060802060408
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Jason Weathersby wrote:
> Can you post your design file?
>
Attached is an example design file that shows exactly the same
behaviour. Privacy prevents me from publishing the actual file.

Stuart.

--------------090002070403060802060408
Content-Type: text/xml;
name="Example.rptdesign"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Example.rptdesign"

<?xml version="1.0" encoding="UTF-8"?>
<!-- Written by Eclipse BIRT 1.0 -->
<report xmlns=" http://www.eclipse.org/birt/2005/design" version="2">
<property name="createdBy">Eclipse BIRT Designer Version 1.0.1 Build &lt;20050729-0746></property>
<property name="units">in</property>
<data-sources>
<oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc" name="DB">
<property name="odaDriverClass">com.mysql.jdbc.Driver</property>
<property name="odaURL">jdbc:mysql://localhost/OVIC_DB</property>
<property name="odaUser">DummyName</property>
<encrypted-property name="odaPassword">RHVtbXlQYXNzd29yZA==</encrypted-property >
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet " name="EntityRefs">
<property name="dataSource">DB</property>
<property name="queryText">select entity_ref
from pcc_entity_list;</property>
</oda-data-set>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet " name="EntityDetails">
<property name="dataSource">DB</property>
<list-property name="parameters">
<structure>
<property name="name">EntityRef</property>
<property name="dataType">string</property>
<property name="position">1</property>
<expression name="defaultValue">1</expression>
<property name="allowNull">true</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
</list-property>
<property name="queryText">select pcc_entity_list.entity_name
from pcc_entity_list
where pcc_entity_list.entity_ref = ?;</property>
</oda-data-set>
</data-sets>
<page-setup>
<simple-master-page name="Simple MasterPage">
<page-footer>
<text>
<property name="contentType">html</property>
<text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<list>
<list-property name="highlightRules">
<structure>
<property name="operator">eq</property>
<property name="backgroundColor">#C0C0C0</property>
<expression name="testExpr">row[0]%2</expression>
<expression name="value1">0</expression>
</structure>
<structure>
<property name="operator">ne</property>
<property name="backgroundColor">#808080</property>
<expression name="testExpr">row[0]%2</expression>
<expression name="value1">0</expression>
</structure>
</list-property>
<property name="dataSet">EntityRefs</property>
<detail>
<data>
<expression name="valueExpr">row[0]</expression>
</data>
<data>
<property name="dataSet">EntityDetails</property>
<list-property name="paramBindings">
<structure>
<property name="paramName">EntityRef</property>
<expression name="expression">row["entity_ref"]</expression>
</structure>
</list-property>
<expression name="valueExpr">row["entity_name"]</expression>
</data>
</detail>
</list>
</body>
</report>

--------------090002070403060802060408--
Re: Alternating colours on table rows. [message #153456 is a reply to message #153174] Thu, 13 April 2006 12:05 Go to previous message
Eclipse UserFriend
Stuart,
Try adding another list or table in the detail of the outer list
where you have row["entity_name"]. I believe the reason this is not working
is because row[0] is tied to the table or list, and when you changed the
binding I dont think its available anymore. Another option is to use a
global script variable and I have attached an example of this.

Jason

Look at this example, it should run in your designer.

<?xml version="1.0" encoding="UTF-8"?>

<!-- Written by Eclipse BIRT 2.0 -->

<report xmlns="http://www.eclipse.org/birt/2005/design" version="3" id="1">

<property name="createdBy">Eclipse BIRT Designer Version 2.0.1 Build
&lt;20060222-1204></property>

<property name="units">in</property>

<method name="initialize"><![CDATA[gblhigh = 0;]]></method>

<data-sources>

<oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc"
name="Data Source" id="4">

<property
name="odaDriverClass">org.eclipse.birt.report.data.oda.sampledb.Driver </property>

<property name="odaURL">jdbc:classicmodels:sampledb</property>

<property name="odaUser">ClassicModels</property>

</oda-data-source>

</data-sources>

<data-sets>

<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
name="Data Set" id="5">

<property name="dataSource">Data Source</property>

<property name="queryText">select *

from orders</property>

</oda-data-set>

<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
name="orderdetails" id="8">

<property name="dataSource">Data Source</property>

<list-property name="parameters">

<structure>

<property name="name">ordernumber</property>

<property name="dataType">integer</property>

<property name="position">1</property>

<expression name="defaultValue">10101</expression>

<property name="allowNull">true</property>

<property name="isInput">true</property>

<property name="isOutput">false</property>

</structure>

</list-property>

<property name="queryText">select CLASSICMODELS.ORDERDETAILS.QUANTITYORDERED

from CLASSICMODELS.ORDERDETAILS where ordernumber = ?</property>

</oda-data-set>

</data-sets>

<page-setup>

<simple-master-page name="Simple MasterPage" id="2">

<page-footer>

<text id="3">

<property name="contentType">html</property>

<text-property name="content"><![CDATA[<value-of>new
Date()</value-of>]]></text-property>

</text>

</page-footer>

</simple-master-page>

</page-setup>

<body>

<table id="12">

<property name="width">100%</property>

<property name="dataSet">Data Set</property>

<column id="19"/>

<header>

<row id="13">

<cell id="14"/>

</row>

</header>

<detail>

<row id="15">

<method name="onCreate"><![CDATA[gblhigh += 1;]]></method>

<list-property name="highlightRules">

<structure>

<property name="operator">eq</property>

<property name="backgroundColor">#C0C0C0</property>

<expression name="testExpr">gblhigh%2</expression>

<expression name="value1">0</expression>

</structure>

</list-property>

<cell id="16">

<data id="20">

<expression name="valueExpr">row[0]</expression>

</data>

<data id="22">

<property name="dataSet">orderdetails</property>

<list-property name="paramBindings">

<structure>

<property name="paramName">ordernumber</property>

<expression name="expression">row["ORDERNUMBER"]</expression>

</structure>

</list-property>

<expression name="valueExpr">row["QUANTITYORDERED"]</expression>

</data>

</cell>

</row>

</detail>

<footer>

<row id="17">

<cell id="18"/>

</row>

</footer>

</table>

</body>

</report>




"Stuart Roe" <stuart.roe@ovic.co.uk> wrote in message
news:e1kv2r$gm$1@utils.eclipse.org...
> Jason Weathersby wrote:
>> Can you post your design file?
>>
> Attached is an example design file that shows exactly the same
> behaviour. Privacy prevents me from publishing the actual file.
>
> Stuart.
>


------------------------------------------------------------ --------------------


> <?xml version="1.0" encoding="UTF-8"?>
> <!-- Written by Eclipse BIRT 1.0 -->
> <report xmlns=" http://www.eclipse.org/birt/2005/design" version="2">
> <property name="createdBy">Eclipse BIRT Designer Version 1.0.1 Build
> &lt;20050729-0746></property>
> <property name="units">in</property>
> <data-sources>
> <oda-data-source
> extensionID="org.eclipse.birt.report.data.oda.jdbc" name="DB">
> <property
> name="odaDriverClass">com.mysql.jdbc.Driver</property>
> <property
> name="odaURL">jdbc:mysql://localhost/OVIC_DB</property>
> <property name="odaUser">DummyName</property>
> <encrypted-property
> name="odaPassword">RHVtbXlQYXNzd29yZA==</encrypted-property >
> </oda-data-source>
> </data-sources>
> <data-sets>
> <oda-data-set
> extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
> name="EntityRefs">
> <property name="dataSource">DB</property>
> <property name="queryText">select entity_ref
> from pcc_entity_list;</property>
> </oda-data-set>
> <oda-data-set
> extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
> name="EntityDetails">
> <property name="dataSource">DB</property>
> <list-property name="parameters">
> <structure>
> <property name="name">EntityRef</property>
> <property name="dataType">string</property>
> <property name="position">1</property>
> <expression name="defaultValue">1</expression>
> <property name="allowNull">true</property>
> <property name="isInput">true</property>
> <property name="isOutput">false</property>
> </structure>
> </list-property>
> <property name="queryText">select pcc_entity_list.entity_name
> from pcc_entity_list
> where pcc_entity_list.entity_ref = ?;</property>
> </oda-data-set>
> </data-sets>
> <page-setup>
> <simple-master-page name="Simple MasterPage">
> <page-footer>
> <text>
> <property name="contentType">html</property>
> <text-property name="content"><![CDATA[<value-of>new
> Date()</value-of>]]></text-property>
> </text>
> </page-footer>
> </simple-master-page>
> </page-setup>
> <body>
> <list>
> <list-property name="highlightRules">
> <structure>
> <property name="operator">eq</property>
> <property name="backgroundColor">#C0C0C0</property>
> <expression name="testExpr">row[0]%2</expression>
> <expression name="value1">0</expression>
> </structure>
> <structure>
> <property name="operator">ne</property>
> <property name="backgroundColor">#808080</property>
> <expression name="testExpr">row[0]%2</expression>
> <expression name="value1">0</expression>
> </structure>
> </list-property>
> <property name="dataSet">EntityRefs</property>
> <detail>
> <data>
> <expression name="valueExpr">row[0]</expression>
> </data>
> <data>
> <property name="dataSet">EntityDetails</property>
> <list-property name="paramBindings">
> <structure>
> <property name="paramName">EntityRef</property>
> <expression
> name="expression">row["entity_ref"]</expression>
> </structure>
> </list-property>
> <expression
> name="valueExpr">row["entity_name"]</expression>
> </data>
> </detail>
> </list>
> </body>
> </report>
>
Previous Topic:How to use class java.util.Calendar by scripting?
Next Topic:Problems with Tomcat deployments failing on classpath
Goto Forum:
  


Current Time: Sat May 10 03:03:24 EDT 2025

Powered by FUDForum. Page generated in 0.03317 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top