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

Highlighting the Record with the Highest Value

Status
Not open for further replies.

plcman

Programmer
Feb 17, 2001
92
GB
Hi

I am using CR XI. I have a report that displays a number of records from my database. Is there anyway to highlight the record with the highest value.

Any help would be appreciated.
 
It depends if you want to highlight the field or the entire 'row'

Use format field or section to apply the fype of highlight you prefer then use the formula button to the right of the highlighting option to set the condition by which the formatting occurs.

In this case for example:

if {table.field} = maximum({table.field}) then crsilver else nocolor

applied to the background 'X2' formula tab, should do the trick

'J

 
Hi

Thanks CR85user, that looks good, but the field I want to highlight is a summary field and when I enter your code using my summarised field, I get the error message this field cannot be summarised.

Any ideas?

Regards

Alan Edwards
 
What is your field? If it is a formula, please post the formula.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
Please identify your summary and at what group level, or show the formula, if you are using one.

-LB
 
Hi

I am trying to use a report summery, using the code above in the formula workshop, this is what comes out with my summery field added.

if Sum ({Activity.tim}, {Activity.act_comment}) = maximum(Sum ({Activity.tim}, {Activity.act_comment})) then crsilver else nocolor

Regards

Alan Edwards
 
You could use a separate field, placed beside the summary field you want to highlight. Have it show a star for the highest and otherwise be blank. Less elegant, but it should work.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
It depends, as lbass has pointed out.

If there is a group based on activity.act_comment and then the display is in the footer of this group then it would not be an issue.

Please do as lbass suggests and specify where you are displaying the info and what groups used

for example:

GH1 - activity.datetime
GH2 - activity.tim
Details - *Summary Shown here*
GF1 - etc etc...

you get the idea..

'J
 
You could use a variable to show the maximum in the report footer, or you could create a command like the following:

select sum(Activity.`tim`) as sumtim, Activity.`act_comment`
from Activity
Group by Activity.`act_comment`

Use the punctuation and syntax appropriate to your datasource. Link this command on the group field (comment) to the Activity table. Then in the main report, you can use a formula like this in the formatting area for background color:

if {Activity.tim} = maximum({command.sumtim}) then
cryellow else crnocolor

-LB
 
Hi

My summery is of a field called 'tim' in a table called 'activity'and it is being displayed in GH2. I would like the highest summery in the group to be displayed in another color.

Regards

Alan Edwards
 
Did you try the suggestions in my last post?

-LB
 
Hi

Lbass, I have had a few problems as this is my first voyage into Crystal Reports, it sort of got dumped on me at the last minuts.

I have sorted most of my problems know thanks to some of your previous posts on other subjects ( mostly using variables).

I have to admit I didn't get youre last post, how do you ' make a command'

Thanks again for all your help
 
Go to database->database expert->your datasource->add command and enter the command there. You have to use the syntax/punctuation appropriate to your datasource, so if you are unsure, go to database->show SQL query and observe how the tables and fields are punctuated there, and then use that in creating the command:

select sum(Activity.`tim`) as sumtim, Activity.`act_comment`
from Activity
Group by Activity.`act_comment`

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top