Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Background color on date cells(How to include background colors to cells in a table)
icon3.gif  Background color on date cells [message #1057896] Thu, 09 May 2013 15:31 Go to next message
Greg Wacker is currently offline Greg Wacker
Messages: 15
Registered: March 2013
Junior Member
Hi-

New to Birt. trying to figure out how to include background colors in a table.

Example table:
Location UserID LName Job Cd Gen Safety
1234 1234567 Smith 0002-001 4/12/2010
1235 1234568 Smith 0001-002 5/5/2011
1236 1234569 Smith 0031-003 12/10/2011
1237 1234561 Smith 0033-001 6/10/2012

The Gen Safety field/column is a date field

Tried using this in the Expression Builder under Properties/Visibility(tab) hitting the function button:

IIF(BirtDateTime.diffDay("GEN_SAFETY", BirtDateTime.now()) >760, RGB(0,0,255))

Here's logic behind Gen Safety's dates:
If > 760 days from today , background color is BLUE
if > 730 days from today , background color is RED
if > 640 days from today, background color is YELLOW
Else (or less than 640 days), background color is GREEN
****see attched table sample*****

It does not work. Any solutions w/b appreciated.
Re: Background color on date cells [message #1057914 is a reply to message #1057896] Thu, 09 May 2013 18:28 Go to previous messageGo to next message
Michael Williams is currently offline Michael Williams
Messages: 1639
Registered: July 2009
Senior Member

Instead of using visibility, have you tried using the highlight feature in the property editor for the date field? You can create expressions for when to highlight.

Michael

Add interactivity, scheduling, sharing, live Excel export, and JS integration to your BIRT app with the new, free BIRT server, BIRT iHub F-Type.
Re: Background color on date cells [message #1058010 is a reply to message #1057914] Fri, 10 May 2013 13:28 Go to previous messageGo to next message
Greg Wacker is currently offline Greg Wacker
Messages: 15
Registered: March 2013
Junior Member
Highlight works with conditions when using exact dates with Between. How could I use a condition as stated above...from today's date back 760 days, if >760 then highlight blue?
Re: Background color on date cells [message #1058011 is a reply to message #1057914] Fri, 10 May 2013 13:31 Go to previous messageGo to next message
Greg Wacker is currently offline Greg Wacker
Messages: 15
Registered: March 2013
Junior Member
Highlight with condition works with exact dates, but what about form today back 760 days?

if date is >760 days from today, highlight BLUE
Re: Background color on date cells [message #1058013 is a reply to message #1057914] Fri, 10 May 2013 13:28 Go to previous messageGo to next message
Greg Wacker is currently offline Greg Wacker
Messages: 15
Registered: March 2013
Junior Member
Highlight works with conditions when using exact dates with Between. How could I use a condition as stated above...from today's date back 760 days, if >760 then highlight blue?
Re: Background color on date cells [message #1058015 is a reply to message #1057914] Fri, 10 May 2013 13:28 Go to previous messageGo to next message
Greg Wacker is currently offline Greg Wacker
Messages: 15
Registered: March 2013
Junior Member
Highlight works with conditions when using exact dates with Between. How could I use a condition as stated above...from today's date back 760 days, if >760 then highlight blue?
Re: Background color on date cells [message #1058016 is a reply to message #1057914] Fri, 10 May 2013 13:31 Go to previous messageGo to next message
Greg Wacker is currently offline Greg Wacker
Messages: 15
Registered: March 2013
Junior Member
Highlight with condition works with exact dates, but what about form today back 760 days?

if date is >760 days from today, highlight BLUE
Re: Background color on date cells [message #1058019 is a reply to message #1057914] Fri, 10 May 2013 13:28 Go to previous messageGo to next message
Greg Wacker is currently offline Greg Wacker
Messages: 15
Registered: March 2013
Junior Member
Highlight works with conditions when using exact dates with Between. How could I use a condition as stated above...from today's date back 760 days, if >760 then highlight blue?
Re: Background color on date cells [message #1058020 is a reply to message #1057914] Fri, 10 May 2013 13:31 Go to previous messageGo to next message
Greg Wacker is currently offline Greg Wacker
Messages: 15
Registered: March 2013
Junior Member
Highlight with condition works with exact dates, but what about form today back 760 days?

if date is >760 days from today, highlight BLUE
Re: Background color on date cells [message #1058023 is a reply to message #1057914] Fri, 10 May 2013 13:31 Go to previous messageGo to next message
Greg Wacker is currently offline Greg Wacker
Messages: 15
Registered: March 2013
Junior Member
Highlight with condition works with exact dates, but what about form today back 760 days?

if date is >760 days from today, highlight BLUE
Re: Background color on date cells [message #1058027 is a reply to message #1057914] Fri, 10 May 2013 13:31 Go to previous messageGo to next message
Greg Wacker is currently offline Greg Wacker
Messages: 15
Registered: March 2013
Junior Member
Highlight with condition works with exact dates, but what about form today back 760 days?

if date is >760 days from today, highlight BLUE
Re: Background color on date cells [message #1058030 is a reply to message #1057914] Fri, 10 May 2013 13:31 Go to previous messageGo to next message
Greg Wacker is currently offline Greg Wacker
Messages: 15
Registered: March 2013
Junior Member
Highlight with condition works with exact dates, but what about form today back 760 days?

if date is >760 days from today, highlight BLUE
Re: Background color on date cells [message #1058038 is a reply to message #1058011] Fri, 10 May 2013 15:04 Go to previous messageGo to next message
Michael Williams is currently offline Michael Williams
Messages: 1639
Registered: July 2009
Senior Member

You should be able to do > 760 days by using the expression builder. You can use the date in the date column, today's date, and a BIRTDateTime diff function.

Something like:
BirtDateTime.diffDay(row["dateField"],new Date());


Michael

Add interactivity, scheduling, sharing, live Excel export, and JS integration to your BIRT app with the new, free BIRT server, BIRT iHub F-Type.
Re: Background color on date cells [message #1058068 is a reply to message #1058038] Fri, 10 May 2013 18:53 Go to previous messageGo to next message
Greg Wacker is currently offline Greg Wacker
Messages: 15
Registered: March 2013
Junior Member
THANK YOU.
Razz
That works.

760 less than or equal to BirtDateTime.diffDay(row["GEN_SAFETY"],BirtDateTime.today())

Have a nice weekend! Razz
Re: Background color on date cells [message #1058172 is a reply to message #1058068] Mon, 13 May 2013 03:38 Go to previous messageGo to next message
Michael Williams is currently offline Michael Williams
Messages: 1639
Registered: July 2009
Senior Member

Great! Glad I could help. Hope you had a great weekend!

Michael

Add interactivity, scheduling, sharing, live Excel export, and JS integration to your BIRT app with the new, free BIRT server, BIRT iHub F-Type.
Re: Background color on date cells [message #1058361 is a reply to message #1058172] Mon, 13 May 2013 17:12 Go to previous messageGo to next message
Greg Wacker is currently offline Greg Wacker
Messages: 15
Registered: March 2013
Junior Member
Any suggestions on how to NOT highlight a null value?

Using 4 different conditions listed above, and they work, but now trying to keep UN highlighted format for those columns with Null vales.
Re: Background color on date cells [message #1058424 is a reply to message #1058361] Tue, 14 May 2013 05:17 Go to previous messageGo to next message
Michael Williams is currently offline Michael Williams
Messages: 1639
Registered: July 2009
Senior Member

Have you tried adding && row["myField"] != null to your conditions?

Michael

Add interactivity, scheduling, sharing, live Excel export, and JS integration to your BIRT app with the new, free BIRT server, BIRT iHub F-Type.
Re: Background color on date cells [message #1058897 is a reply to message #1058424] Wed, 15 May 2013 15:10 Go to previous messageGo to next message
Greg Wacker is currently offline Greg Wacker
Messages: 15
Registered: March 2013
Junior Member
Tried that, but can't seem to get the condition to work.

760 less than or equal to BirtDateTime.diffDay(row["GEN_SAFETY"],BirtDateTime.today())

Current condition above works to highlight in BLUE, but still need help with how to adress NULL values in the condition.
Re: Background color on date cells [message #1058965 is a reply to message #1058897] Thu, 16 May 2013 04:39 Go to previous message
Michael Williams is currently offline Michael Williams
Messages: 1639
Registered: July 2009
Senior Member

Try something like:

if(row["GEN_SAFETY"] != null){
   if(BirtDateTime.diffDay(row["GEN_SAFETY"],BirtDateTime.today()) > 760){
      true;
   }
   else{
      false;
   }
}
else{
   false;
}

is True


Michael

Add interactivity, scheduling, sharing, live Excel export, and JS integration to your BIRT app with the new, free BIRT server, BIRT iHub F-Type.
Previous Topic:BIRT in eclipse
Next Topic:Report Date and Timestamp Converstion
Goto Forum:
  


Current Time: Sun Oct 26 01:10:48 GMT 2014

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

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