Crystal Reports Group Headers

I’m creating a report to see when peoples times were adjusted under Time and Expense Entry. I have everything populating how I want it I’m just doing some final formatting. Essentially I only want the group header (EmpBasic.Name) to display if details are not suppressed. I have a condition where if the actual clock in/out time and adjusted clock in/out time match then suppress that as I am only looking for them differing. I have a count that is them totaling the number of adjustments that were made and displaying that information in the footer.

I can get the footer to suppress fine if all the details are suppressed. What I cannot get to work is suppressing the headers. I tried a flag formula that says if x then 0 else 1 with a sum(x, group field) that didn’t work as my flag field couldn’t be summarized. I’ve tried using my count formula. It works, but not how I need it to. It’s suppressing or not suppressing the next person on the list.

Printed Name
------------Total Adjustments: 2
Printed Name
-----------Total Adjustments: 0
Suppressed Name
----------Total Adjustments: 1

I’ve read suggestions about adding a subreport but I just haven’t wanted to go that route yet. Any ideas?

Can you create a calculated field at the source (in the BAQ) for the difference between the actual clock in/out time and adjusted clock in/out time?

If so, call it TimeDiff. Then suppress the group based on if Sum(TimeDiff, EmpBasic.Name) = 0.

EDIT: Might want to take the ABS of the difference (or square the diff), so that a 10 minute late clockout and a 10 minute early clockout don’t cancel when summed up.

Calvin,

I tried something similar to that. I created a formula (@Suppress) as a flag statement and placed it in my details

if (CStr({LaborHed1.ActualClockInTime}) = CStr({@DispClockInTime}) or
CStr({LaborHed1.ActualClockOutTime}) = CStr({@DispClockOutTime})) then 0
else 1;

But when I try to do a sum({@Suppress}, {EmpBasic.Name}) I get an error stating that @Suppress can’t be summarized.

@DispClockInTime and @DispClockOutTime simply convert the time format to a Hour.Hundreths format to compare to LaborHed.ActualClockInTime and LaborHed.ActualClockOutTime

The problem is that calculating the result of @Surpress happens at runtime, down in the details. Since the group headers are processed before the detail section, that calculated value cant be used. That’s why I said it had to be in the BAQ (or source data).

If the value of TimeDiff exists for every record BEFORE details are processed, then it can be used by the aggregate SUM function in the group header.

That makes sense. So I have gone down the road of adding a sub report. I simply made a copy of my current report and added it as a sub report in the Page Header and suppressed it. I linked EmpBasic.Name, EmpBasic.EmpID, and LaborHed.LaborHedSeq. I have a shared variable in my sub report that I’m trying to pass back to my main report, but it’s not returning the correct (or any value other than 0). I’ve added a formula to call that shared variable in my Group Header so it is below the sub report.

I don’t think it’s associating the sub report group with the main report group properly.

Is it not possible to create a calculated field at the source data?

What is the source? RDD (Report Data Def), BAQ, ODBC?

ODBC. I’m creating the report from scratch, just pulling in the fields I need to work from.

It’s kind of a hack (and may mess up other parts of your report) …

Use the Record Select formula editor to only include records without matching clock-in and clock out times

{LaborHed1.ActualClockInTime} <> {LaborHed1.ActualClockOutTime}

if you need some leway…
> …and
> (({LaborHed1.ActualClockInTime} - {LaborHed1.ActualClockOutTime} > 10) OR
> ({LaborHed1.ActualClockOutTime} - {LaborHed1.ActualClockInTime} > 10))

EDIT: THIS CAN MAKE THE QUERY RUN REALLY SLOW!!!

Calvin,

I got it working, after 2 and a half days…most of the headaches this morning were a result of me not exactly knowing how crystal reports processes information. I added my sub report and I linked all my groups and in previewing it I was seeing accurate data. The variables however weren’t passing to my main report. The problem, unchecking “Can Grow” on my sub report properties. Once I did that my variable information was displaying properly, from there I just had to figure out how to hide all the information in the sub report that I didn’t want to see. Once I did that I was able to set my suppress formula for my header and viola…I finally achieved what I was looking for.