Print Page | Close Window

Format Colors

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22569
Printed Date: 29 Apr 2024 at 2:49pm


Topic: Format Colors
Posted By: rculbertson
Subject: Format Colors
Date Posted: 04 Apr 2018 at 10:49am
I am currently building a report with the the following formula:

if {TrainingObjectiveHistory.tohobjTitle} = "iso facility use hours" and {TrainingObjectiveHistory.tohseshrs} <18 then crred

The formula has no errors but it does not turn totals <18 red but turns all numbers red. I need it to only turn <18 red.

-------------
Rculbertson



Replies:
Posted By: DBlank
Date Posted: 05 Apr 2018 at 8:24am
if the <18 condition supposed to be based on a group or report SUM?


Posted By: rculbertson
Date Posted: 05 Apr 2018 at 8:35am
Report sum

-------------
Rculbertson


Posted By: DBlank
Date Posted: 05 Apr 2018 at 8:54am
Your current formula is a row level analysis of the value of that field on that row.
If you want the sum to be highlighted use the below formula on the sum field.

if {TrainingObjectiveHistory.tohobjTitle} = "iso facility use hours" and SUM({TrainingObjectiveHistory.tohseshrs}) <18

Although I think you still have an issue because this would be the the total sum and not the sum where the row is like the "iso..." condition. If you are trying to that you need to use a conditional running total or another formula field that you would sum.

//iso_only formula
if {TrainingObjectiveHistory.tohobjTitle} = "iso facility use hours" then {TrainingObjectiveHistory.tohseshrs} else 0

sum that to see if it is <18
SUM(@iso_only)


Posted By: rculbertson
Date Posted: 05 Apr 2018 at 9:28am
The {TrainingObjectiveHistory.tohobjTitle} has different title like the "iso facility use hours".

The top formula you had changed all colors.

I am looking to just change the {TrainingObjectiveHistory.tohobjTitle} titled "iso facility use hours" a color and not the rest.

-------------
Rculbertson


Posted By: DBlank
Date Posted: 05 Apr 2018 at 10:19am
so you want to change the font color of tohobjTitle field?
You want the field to be red when what the title value = 'iso facility use hours' and the sum of all tohseshrs < 18 or only if the sum of the tohseshrs rows where title = 'iso facility use hours' < 18?


Posted By: rculbertson
Date Posted: 05 Apr 2018 at 10:24am
only if the sum of the tohseshrs rows where title = 'iso facility use hours' < 18

And then for other titles I would do the same for the required hours for each

-------------
Rculbertson


Posted By: DBlank
Date Posted: 06 Apr 2018 at 2:34am
Create a formula field you will use to get the sum where only title = 'iso facility use hours'
call it something like "iso_facility_use_hours_only".
it will be
if {TrainingObjectiveHistory.tohobjTitle} = "iso facility use hours" then {TrainingObjectiveHistory.tohseshrs} else 0
now you will sum that formula field
for the color condition it will be

if {TrainingObjectiveHistory.tohobjTitle} = "iso facility use hours" and sum(@iso_facility_use_hours_only)<18 then CrRed else CrBlack

Or you might consider grouping on tohobjTitle and using the group level sum but that will possibly change your sort order or structure too much for whatever else the report is for.


Posted By: rculbertson
Date Posted: 06 Apr 2018 at 9:02am
Not working but thank you.
The
if {TrainingObjectiveHistory.tohobjTitle} = "iso facility use hours" and sum(@iso_facility_use_hours_only)<18 then CrRed else CrBlack

Is saying its missing a )

-------------
Rculbertson


Posted By: DBlank
Date Posted: 06 Apr 2018 at 10:02am
can you copy and paste the exact text you are using for that condition format


Posted By: rculbertson
Date Posted: 06 Apr 2018 at 10:06am
if {TrainingObjectiveHistory.tohobjTitle} = "iso facility use hours" and {TrainingObjectiveHistory.tohseshrs} <18 then crred

-------------
Rculbertson


Posted By: DBlank
Date Posted: 06 Apr 2018 at 10:15am
dis you make the formula field for the conditional sum?...

Create a formula field you will use to get the sum where only title = 'iso facility use hours'
call it something like "iso_facility_use_hours_only".
it will be
if {TrainingObjectiveHistory.tohobjTitle} = "iso facility use hours" then {TrainingObjectiveHistory.tohseshrs} else 0


Posted By: rculbertson
Date Posted: 06 Apr 2018 at 10:50am
if {TrainingObjectiveHistory.tohobjTitle} = "iso facility use hours" and sum(@iso_facility_use_hours_only)<18 then CrRed else CrBlack

Is still saying "The ) is missing

-------------
Rculbertson


Posted By: DBlank
Date Posted: 09 Apr 2018 at 3:56am

if {TrainingObjectiveHistory.tohobjTitle} = "iso facility use hours" and sum({@iso_facility_use_hours_only})<18



Print Page | Close Window