Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing background color of column

Status
Not open for further replies.

PGoRule

Programmer
Jul 26, 2006
438
IN
My friend (He don't have access to internet from office) is using Crystal Reports 8 on Employee leaves management system. He is stuck with the following problem:
Suppose I have a list of dates from 26th of previous month to 25th of this month.These dates are arranged serially within their columns. I have taken seperate field for each day of the month in table. I have feed all the required fields in the repective columns.
How to change the background color of an field in Crystal report that I have inserted at runtime? For.eg : If it is Sunday then I want to change the color of that field.
Please let me know how to wdo this in order to change the background color of the column for each row.
Can anybody point me to resource with Crystal report CrossTab query?

Thanx...

Sharing the best from my side...

--Prashant--
 
You can get day of the week using
Code:
DatePart("w", {your.date})
This gives a number 1 to 7, with Sunday as 1. This works in 8.5, at least. Make this a formula field.

To use it, right-click on the field and choose [Format Field]. Background can be set from the [Border] tab, and can be done using a formula, the icon of x+2 and a pencil. [Functions] includes [Colour Constants]



[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
You should have provided the column, row, and summary fields for the crosstab, and also identified the datatype of your date field. To color a specific row or column, you would select an inner cell->format field->border->color->background->x+2 and use a formula like:

if dayofweek(gridrowcolumnvalue("table.date")) = 1 then crYellow else crNoColor

...where 1 = Sunday, 2 = Monday, etc. You would place your column or row field inside the () for gridrowcolumnvalue, but replace the curly brackets around the field with "".

-LB
 
Thanx Madawc and lbass...
I'll get back as soon as I receive some feedback from him...

Sharing the best from my side...

--Prashant--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top