Showing results for 
Search instead for 
Did you mean: 

Crystal Report show value in Group footer

0 Kudos

Hi there,

i have the following problem:

Example of my detail section (which is grouped by item number). The item is stored in different units and units contain different Batch numbers. Goal is to see the smallest /oldest Batch# and the correct unit to it.

Unit: Batch#

1000004840 2022256

1000004837 2022257

1000004837 2022180

1000004839 2022203

1000004839 2022256


The smallest batch# here is 20222180 (i pulled the smallest value in the group section). But how am I able to get the correct unit to the smallest batch# - which should be 1000004837.

If I just put the field on the group footer it doesnt show the right unit (of course) but I am lost on how to set this up.

Any Ideas ?

Thank you


Accepted Solutions (1)

Accepted Solutions (1)

Active Contributor

Try sorting descending by batch number and then putting both the batch number and the unit number in the group footer. This only makes sense if you're suppressing the details section.

Another way to do this involves using formulas and variables. It would work something like this:

{@Calc Smallest Batch}
NumberVar smallbatch;
NumberVar smallunit;
//Initialize the variables for this group
If OnFirstRecord or {MyTable.GroupField} <> Previous({MyTable.GroupField}) then
  smallbatch := minimum({MyTable.Batch}, {MyTable.GroupField})
  smallunit := 0;
If {MyTable.Batch} = smallbatch then
  smallunit := {MyTable.Unit};

Use this formula in the details instead of the batch field.

You'll then need two formulas you'll put in the group footer to display the values:

NumberVar smallbatch

NumberVar smallunit


oh my god... I feel so stupid right now.

I was thinking so complicated and tried a ton of different ways but I seriously didnt even think about sorting. The easiest way possible.

Guess its time for the weekend.

Thanks so much Dell

Answers (0)