Title: Descriptions For Min Max Values
vc727 - January 3, 2007 04:42 PM (GMT)
I am trying to write a report that shows the lowest and highest paid positions in each of our process levels.
I seem to be able to get the min and max values ok but I am failing at getting the position descriptions for each of these values. I appear to be able to get the min description but I think this may be a fluke because I am trying to use a similar formula for the max and it doesn't work
I was trying
If {@Max }={Command.PAY_RATE}
Then {Command.DESCRIPTION}
Else "C#%P"
{@Max} is a formula
Maximum ({Command.PAY_RATE},{Command.PROCESS_LEVEL} )
and it comes back blank but when I do the same thing for Min I get a title which seems to match min wage employee.
I am just getting started with crystal, what am I doing wrong?
cjmart - January 5, 2007 04:28 AM (GMT)
I've only had a short time to spend on this, but this seems to be a bit trickier than I thought it would be. Getting the min and max value is easy enough:
Insert a group on process level. Insert your fields into the detail. Right-click on the pay rate field and select Insert --> Summary, choose Maximum and select the process level group option in the Summary. Repeat this again for Minimum.
I suppose you could utilize a subreport to find positions associated with these max/min values by process level, but as a rule I avoid subreports.
There are some Oracle Analytic functions (Dense Rank, Partition) that I used to accomplish this in an inline view (identify either max or min pay rate for each process level and the related position descriptions), but ran into problems identifyin min AND max in one query as the union didn't like the required order by. If this would've worked you could've just pasted the sql into the command object, dumped the fields on the report, and you would've been done. I prefer to write reports this way for a number of reasons, not the least of which is that it shifts the heavy lifting to your Oracle RDBMS. Of course, that assumes you are even on Oracle...
There may be additional Crystal functions that will help accomplish this, but I can't think of any right now.
I'll repost if I find the time to come up with a solution...
vc727 - January 5, 2007 03:17 PM (GMT)
Chris thanks for the response I think I figured it out though. I'm not sure it's the best way but it worked
The query I built pulled in all people and thier position information incuding pay rate. i then created some formula fields.
One for minimum rate.
One for maximum rate
One to put a flag to say it that record was a min or max rate all other were assigned " ".
Then in the section expert I created a formula to only show those records that were flagged as MIN or MAX by supressing all records flagged as " ".
It works like a champ.
cjmart - January 12, 2007 04:29 AM (GMT)
Happy to hear you worked it out your own way! That's the best way to learn.
Even if you are a Cubs fan... :tyson:
vc727 - January 12, 2007 08:05 PM (GMT)
Better be nice to the Cubs or we won't contract you to do any more Report Writing for us.
cjmart - January 12, 2007 08:27 PM (GMT)
Eric,
That's too funny...I didn't realize that was you. Did you just add that signature?
As far as the Cubbies, at least I can't say the owner(s) isn't willing to spend money this year!
Soriano: 8 yrs/$136 mil
Ramirez: 5 yrs/$75 mil
Lilly: 4 yrs/$40 mil
Marquis: 3 yrs/$21 mil
Derosa: 3 yrs/$13 mil
Blanco: 3 yrs/$5.25 mil
etc...
Wow!!! Between Soriano, Ramirez, and Marquis, there will definitely be more souvenirs in the bleachers at Wrigley this year!