Skip to main content



      Home
Home » Archived » BIRT » Blanks when highlighting every other row
Blanks when highlighting every other row [message #139395] Sun, 05 March 2006 21:31 Go to next message
Eclipse UserFriend
When I put in conditional highlighting (row[0] % 2 equal 0) on my row, the
empty string fields are left white in a highlighted row. This looks
terrible! Any solutions?
Thanks in advance.
Re: Blanks when highlighting every other row [message #139919 is a reply to message #139395] Mon, 06 March 2006 15:50 Go to previous messageGo to next message
Eclipse UserFriend
Did you check that no background color (it must be set to 'automatic')
is assigned to the string element.
If you specify a white background for the string element this will not
be overridden by the highlighting of the row.

Hope this helps
Peter
Re: Blanks when highlighting every other row [message #139967 is a reply to message #139919] Mon, 06 March 2006 16:36 Go to previous messageGo to next message
Eclipse UserFriend
Thanks, but there was no background color set. I tried setting it to auto
anyway, it made no difference. When I have a blank char() field it will
still highlight but a blank varchar() field will not.
Please give me anymore suggestions you might have or if you have gotten
this to work please let me know what you did and possibly give a copy of
the source code.
Thanks
Re: Blanks when highlighting every other row [message #140056 is a reply to message #139967] Mon, 06 March 2006 17:46 Go to previous messageGo to next message
Eclipse UserFriend
This is a multi-part message in MIME format.
--------------030208050003040308050807
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Another way to skin the cat is to use JavaScript in the onCreate
function on the row. The code might look something like this:

rc = this.parent.getNamedExpressionValue("rwc");
if( rc % 2 == 0 ){
this.style.backgroundColor = "Silver";
}

I've attached a sample report against the built-in Classic Models
database that Jason Weathersby did to demonstrate the technique.

--MC

abaile wrote:
> Thanks, but there was no background color set. I tried setting it to
> auto anyway, it made no difference. When I have a blank char() field it
> will still highlight but a blank varchar() field will not.
> Please give me anymore suggestions you might have or if you have gotten
> this to work please let me know what you did and possibly give a copy of
> the source code.
> Thanks
>


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

<?xml version="1.0" encoding="UTF-8"?>
<!-- Written by Eclipse BIRT 1.0 -->
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3" id="1">
<property name="createdBy">Eclipse BIRT Designer Version 2.0.0 Build &lt;20060106-0544></property>
<property name="units">in</property>
<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 Customers</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="6">
<list-property name="userProperties">
<structure>
<property name="name">rwc</property>
<property name="type">expression</property>
<property name="default">row[0]</property>
</structure>
</list-property>
<property name="width">100%</property>
<property name="dataSet">Data Set</property>
<column id="75"/>
<column id="76"/>
<column id="77"/>
<column id="78"/>
<column id="91"/>
<header>
<row id="7">
<cell id="8">
<label id="9">
<text-property name="text">CUSTOMERNUMBER</text-property>
</label>
</cell>
<cell id="10">
<label id="11">
<text-property name="text">CUSTOMERNAME</text-property>
</label>
</cell>
<cell id="12">
<label id="13">
<text-property name="text">CONTACTLASTNAME</text-property>
</label>
</cell>
<cell id="14">
<label id="15">
<text-property name="text">CONTACTFIRSTNAME</text-property>
</label>
</cell>
<cell id="88"/>
</row>
</header>
<detail>
<row id="34">
<method name="onCreate"><![CDATA[rc = this.parent.getNamedExpressionValue("rwc");
if( rc % 2 == 0 ){
this.style.backgroundColor = "Silver";
}]]></method>
<list-property name="userProperties">
<structure>
<property name="name">rwcnt</property>
<property name="type">expression</property>
<property name="default">row[0]</property>
</structure>
</list-property>
<cell id="35">
<data id="36">
<expression name="valueExpr">row["CUSTOMERNUMBER"]</expression>
</data>
</cell>
<cell id="37">
<data id="38">
<expression name="valueExpr">row["CUSTOMERNAME"]</expression>
</data>
</cell>
<cell id="39">
<data id="40">
<expression name="valueExpr">row["CONTACTLASTNAME"]</expression>
</data>
</cell>
<cell id="41">
<data id="42">
<expression name="valueExpr">row["CONTACTFIRSTNAME"]</expression>
</data>
</cell>
<cell id="89">
<data id="92">
<method name="onCreate"><![CDATA[this.value = this.parent.parent.parent.getNamedExpressionValue("rwc");]] ></method>
</data>
</cell>
</row>
</detail>
<footer>
<row id="61">
<cell id="62"/>
<cell id="63"/>
<cell id="64"/>
<cell id="65"/>
<cell id="90"/>
</row>
</footer>
</table>
</body>
</report>

--------------030208050003040308050807--
Re: Blanks when highlighting every other row [message #140142 is a reply to message #140056] Mon, 06 March 2006 22:55 Go to previous messageGo to next message
Eclipse UserFriend
Thank You,
That was a big help. I also learned from the code you attached, that,
along with adding the javascript to the row onCreate Method, you must add
a named expression to the table or list with the name set to rwc(same as
in javascript) and a default value of row[0]. And, like you said, the
background color cannot be set. One of my reports had the background
colors set to white in the xml code even though it was not set in the
normal layout.
Re: Blanks when highlighting every other row [message #140796 is a reply to message #140142] Tue, 07 March 2006 10:21 Go to previous message
Eclipse UserFriend
abaile wrote:

> Thank You,
> That was a big help. I also learned from the code you attached, that,
> along with adding the javascript to the row onCreate Method, you must add
> a named expression to the table or list with the name set to rwc(same as
> in javascript) and a default value of row[0]. And, like you said, the
> background color cannot be set. One of my reports had the background
> colors set to white in the xml code even though it was not set in the
> normal layout.

One more solution is to define in data cell something like this:
if ((row["Diagnosis"] == null) || (row["Diagnosis"] == "")) {
" ";
}
else {
row["Diagnosis"];
}

It works I have checked.
Previous Topic:Session variables
Next Topic:Number sign in Image URI
Goto Forum:
  


Current Time: Wed Jul 16 14:32:02 EDT 2025

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

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

Back to the top