cancel
Showing results for 
Search instead for 
Did you mean: 

Formula assistance

Former Member
0 Kudos

I am working on an employee position report that lists the minimum, maximum, and midpoint for each position.  That date resides in a table where one field (step) indicates either Min, Mid or Max and then corresponds to the pay rate (rate).  Looks like this (data isn't real):

StepSalaryRateHourlyRate
MIN20,00020.00
MID30,00030.00
MAX40,00040.00

When I pull the fields into the Crystal report, of course it lists each one horizontally.  However, I want it listed vertically.  For example:

We want:

It shows:

Any thoughts? 

Accepted Solutions (1)

Accepted Solutions (1)

DellSC
Active Contributor
0 Kudos

Here's what I would do:

1.  We're going to use some variables to collate this information.  So the first thing you're going to do is group on Position.

2.  Create a single formula to initialize the variables.  It will look like this:

     WhilePrintingRecords;

     NumberVar MinSalary := 0;

     NumberVar MinHour := 0;

     NumberVar MidSalary := 0;

     NumberVar MidHour := 0;

     NumberVar MaxSalary := 0;

     NumberVar MaxHour := 0;

     Place this formula in the Position Group Header section.

3.  Create a formula for each - Min, Mid, Max.  They will look something like this:

     WhilePrintingRecords;

     NumberVar MinSalary;

     NumberVar MinHour;

     if {MyTable.Step} = "MIN" then

     (

          MinSalary := {MyTable.SalaryRate);

          MinHour := {MyTable.HourlyRate);

     );

     ""

     Place these formulas in the details section.  They won't display anything because of the final empty string.

3.  Finally, create a final set of formulas - one for each of the variables.  Something like this:

     {@MinSalary}

     WhilePrintingRecords;

     NumberVar MinSalary

     NOTE:  Be sure to NOT include the semicolon at the end of the last line - if it's there the value won't appear on the report.

4.  In the Position group footer, place the formulas from step 3 so that they display as in your example.

-Dell

abhilash_kumar
Active Contributor
0 Kudos

Another way to do this is:

1) Insert a Group on the 'Position' field

2) Create a formula called (@MI_Sal) with this code:

if {MyTable.Step} = "MIN" then

     {MyTable.SalaryRate)

3) Create another formula called (@MI_Hourly) with this code:

if {MyTable.Step} = "MIN" then

     {MyTable.HourlyRate)


4) Go to Insert Summary > Choose the @MI_Sal formula as the 'Filed to Summarize' > Under 'Summary Location' choose 'Group Footer' > Under 'Summary Operation' choose 'Maximum'


5) You can then move the summary from the Group Footer to the Group Header if that's where you intend to display the data


6) Repeat Steps 2 through 4 for all the other fields


-Abhilash

Former Member
0 Kudos

Thank you so much!  That worked perfectly.

Answers (0)