on 01-26-2023 10:16 PM
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
Jacqueline
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}
WhilePrintingRecords;
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};
{MyTable.Batch}
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:
{@ShowBatch}
WhilePrintingRecords;
NumberVar smallbatch
{@ShowUnit}
WhilePrintingRecords;
NumberVar smallunit
-Dell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
61 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.