Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » unable to highlight a cell(cannot highlight a cell that has time info)
unable to highlight a cell [message #730979] Thu, 29 September 2011 16:17 Go to next message
kayanserdar is currently offline kayanserdarFriend
Messages: 20
Registered: April 2011
Junior Member
hello all,

I have been trying to highlight a cell with some time condition.
There is a time info is populated via script in a cell with following format:YY-MM-DD hh:mm:ss a
This info is refreshed daily and cell is formatted as "h:mm:ss a"

I have created 3 conditions below to highlight this cell in Yellow, Red, or Green however i always see this cell highlighted in red.

Green:if time in cell is less than or equal to 7:00:00 AM
row[X] less than or equal to
var d = new Date();
d.setHours(07,0,0);

Yellow: If time is between 07:00:01 AM and 08:00:00 AM
row[X] between
var date = new Date
date.setTime(7,0,1)
and
var date = new Date
date.setTime(8,0,0)

Red: if time is greater thanor equal to 08:01:00 AM
row[X] greater than or equal
var d = new Date();
d.setHours(08,0,1);

Not sure if there is any logic missing there but i am always getting red highlighted cell, any help is much appreciated.

Cheers,
Serdar
Re: unable to highlight a cell [message #731013 is a reply to message #730979] Thu, 29 September 2011 17:15 Go to previous messageGo to next message
Prashant Jha is currently offline Prashant JhaFriend
Messages: 18
Registered: September 2011
Junior Member
Are you creating a complete date object? Just the time may not be a valid date object. Instead of creating a new date object why don't you use row[X] getHour function and compare it to be withing the integers?
Re: unable to highlight a cell [message #731014 is a reply to message #730979] Thu, 29 September 2011 17:15 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

What does your expression look like for the var d = new Date();
Is the last line d.setHours... If so that is the value that will be
returned by the expression. Use something like:

var myDate = new Date();
myDate.setHours(12);
myDate.setMinutes(59);
myDate.setSeconds(59);
myDate;

Notice the last line is myDate which is what will get returned by the
expression.

Jason

On 9/29/2011 12:17 PM, kayanserdar wrote:
> hello all,
>
> I have been trying to highlight a cell with some time condition.
> There is a time info is populated via script in a cell with following
> format:YY-MM-DD hh:mm:ss a
> This info is refreshed daily and cell is formatted as "h:mm:ss a"
>
> I have created 3 conditions below to highlight this cell in Yellow, Red,
> or Green however i always see this cell highlighted in red.
>
> Green:if time in cell is less than or equal to 7:00:00 AM
> row[X] less than or equal to var d = new Date();
> d.setHours(07,0,0);
>
> Yellow: If time is between 07:00:01 AM and 08:00:00 AM
> row[X] between var date = new Date
> date.setTime(7,0,1)
> and var date = new Date
> date.setTime(8,0,0)
>
> Red: if time is greater thanor equal to 08:01:00 AM
> row[X] greater than or equal var d = new Date();
> d.setHours(08,0,1);
>
> Not sure if there is any logic missing there but i am always getting red
> highlighted cell, any help is much appreciated.
>
> Cheers,
> Serdar
Re: unable to highlight a cell [message #731071 is a reply to message #731013] Thu, 29 September 2011 20:46 Go to previous messageGo to next message
kayanserdar is currently offline kayanserdarFriend
Messages: 20
Registered: April 2011
Junior Member
I have tried below so i can compare hours to hours and minutes to minutes, still same.
row["X"].getHours() ,row["X"] .getMinutes()

today's info is retrieved on that cell is 2011-09-29 03:54:27 and i would like to compare this info with 2011-09-29 07:00:00. and when data in that cell is less than or equal to 2011-09-29 07:00:00 it should be highlighted as Red.

Data on hat cell will be refreshed every day so tomorrow i will have 2011-09-30 HH:mm:ss and i still want to compare with 2011-09-30 07:00:00 that is why i have used below expression:
var d = new Date();
d.setHours(07,0,0);

I hope this make more clear.

Cheers,
Serdar
Re: unable to highlight a cell [message #731294 is a reply to message #731071] Fri, 30 September 2011 14:22 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I understand, but the last line has to by d in your case not d.setHours.
Take a look at the attached example.

Jason

On 9/29/2011 4:46 PM, kayanserdar wrote:
> I have tried below so i can compare hours to hours and minutes to
> minutes, still same.
> row["X"].getHours() ,row["X"] .getMinutes()
>
> today's info is retrieved on that cell is 2011-09-29 03:54:27 and i
> would like to compare this info with 2011-09-29 07:00:00. and when data
> in that cell is less than or equal to 2011-09-29 07:00:00 it should be
> highlighted as Red.
>
> Data on hat cell will be refreshed every day so tomorrow i will have
> 2011-09-30 HH:mm:ss and i still want to compare with 2011-09-30 07:00:00
> that is why i have used below expression:
> var d = new Date();
> d.setHours(07,0,0);
>
> I hope this make more clear.
>
> Cheers,
> Serdar
Re: unable to highlight a cell [message #731305 is a reply to message #731294] Fri, 30 September 2011 15:10 Go to previous message
kayanserdar is currently offline kayanserdarFriend
Messages: 20
Registered: April 2011
Junior Member
Hello Jason,

I see now why it was not highlighting after your example Smile
I have modified all 3 conditions according to your example and all of them works fine.

Thank you so much.

Cheers,
Serdar
Previous Topic:Different series label
Next Topic:Error deploying BIRT 3.7 to JBOSS 6.0.0
Goto Forum:
  


Current Time: Thu Apr 25 15:14:24 GMT 2024

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

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

Back to the top