View Single Post
  #3 (permalink)  
Old 07-09-2009, 02:10 AM
fenix4life
 
Posts: n/a
Default Re: Change color of one cell in crosstab depending of non crosstab data (BIRT 2.5)

Jason Weathersby wrote:

> Where is the crosstablocation defined?

> Jason

> fenix4life wrote:
>> Hello,
>>
>> I've found on the forum a way to change the color of a cell by using the
>> function onCreateCell and
>> cellInst.getStyle().setBackgroundColor("#FF0000").
>>
>> Now I have a data source which looks a bit like this:
>>
>> Duration
>> Distance
>> Cross_Price
>> Cross_Duration
>> Cross_Distance
>>
>> The cross variables are used for my crosstab.
>>
>> Duration1 Duration2
>> Distance1 Price1 Price2
>> Distance2 Price3 Price4
>>
>> What I would like to achieve is that the cell where the crosstablocation
>> is equal to Distance / Duration has a different background color.
>>
>> Is something like this possible?
>>
>> Thx in advance.
>>
That might be a starting point i'm missing.

The only thing I have now is a basic crosstab with a basic formula on the
createcell.
i = 0;
function onCreateCell( cellInst, reportContext )
{
if (i == 0){

cellInst.getCellID();
cellInst.getStyle().setBackgroundColor("#0000FF");
i=1;
}
else {
cellInst.getStyle().setBackgroundColor("#FF0000");
i=0;
}
}

That changes the color in a chess way.
The positive thing is that it shows the possibilities of scripting but I
would like to couple the backgroundcolor function with a check on other
fields.

It would be something like

if(locationcellX.value = field1 && locationcellY.value = field2)
then
changebackgroundcolor