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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

format report with alternate color

Status
Not open for further replies.

unknownly

Programmer
Jul 7, 2003
181
US
Hi All,

How can I format a report with different colour when the time changes in a datetime field.

Ex:

unit account amount updated date
1000 ac001 $345 18-FEB-2004:03:03:40
2000 ac001 $367 18-FEB-2004:03:03:40
1000 ac002 $203 18-FEB-2004:03:09:44
3000 ac003 $267 18-FEB-2004:03:09:44

I need one colour for the 1st to rows because they are of same time.
Iam grouping by session name and updated date field in the report.I am using CR ver 8

Any advice is greatly appericated

Thanks in advance,

Sweetie



 
Well this depends mostly on what you are trying to do. It seems like you are trying to change the color of the entire row not just one field.

Here is what you need to do. In design view
Right Click the section name (lets say details) > Format section > Color > X+2 > Enter formula

If {table.field} = “your condition” then Silver else Nocolor

This will change the color of the background where your condition is matched.

Kchaudhry
 
You could group on {table.updateddate} and then suppress the group header and footer. Then go to format->section->details->color->background color->x+2 and enter:

if remainder(groupnumber, 2) = 0 then crRed else crYellow

This would cause alternating groups in different colors.

-LB
 
Thank you guys for the response.

Lbass,

I am using your logic. If you don't mind can you explain me what happenes when you use Groupnumber in you formula

if remainder(groupnumber, 2) = 0 then crRed else crYellow

Thanks again

Sweetie
 
If you have grouped on the datetime, all members of the group will have the same groupnumber. You can go to insert->special field->group number and add it to the report canvas to see that this is true. Now that you have the dates clustered like this, you can use the color formula. The color formula states that if the groupnumber is divisible by 2 and there is no remainder, then color the group red, otherwise color it yellow.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top