Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grouping items that are within a certain amount

Status
Not open for further replies.

tsh1586

Technical User
Oct 31, 2019
15
US
Is there a way to group crystal report items that falls within a certain span of each other?

I have several lines within each invoice on my crystal report. I currently have grouped by invoice number but I want to group lines within that group.
The taxable amount of each invoice is calculation so some times it can vary a bit because of the dividing of such a small percentage. I am looking to group the item that are within say 25 cents of each other together within the invoice group.

Example:

one line the calculated taxable amount is 5.90 on the second line which shows the additional tax amount the taxable amount is 6.00 I want these items grouped together. I can have several lines for each invoice and I am unable to find any other details to group these items on.

 
I am not sure if that would be possible. I believe any calculations and summaries take place after the grouping (logically it makes sense). I do not presently have a solution.
 
Thanks for replying. The only other detail item that I have that shows any type of connection is the transaction ID. The items that need to be grouped together are sequential in number but there is a gap between those and the starting of the next group. For example the items to be grouped together are showing transaction numbers
70200
70201
then it skips to
70203
70204
for the next group

Is there any way to group on items that are in sequential order or create a group at each gap in the order? I's grasping at straws on this one.
 
Maybe. Again it looks like some calculations would have to be done. I will check to see what is possible.
 
Insert a group on this formula:

numbervar x;
numbervar y := x;
numbervar x := {transactionnumber};
numbervar z;
if x=y+1 then
z := y else
z := x;
z

This isn't based on amounts, though. It only reflects contiguous transaction numbers.

-LB
 
So that worked for the first items but then fell apart. I have a group already set up based on the invoice ID. Within those groups is the individual invdistid numbers which is what I was needing the second grouping on.
When it got to the second group I had the following numbers grouped under Invoice ID 19299
70203
70204
70208
70209
70215
70216
70218
70219
70221
70222
It made a separate group of 70208 and did not create a group for any other items. It created a group name for group 2 (invdistid) that is the same or one digit different from what the invoice ID group name is for each group
crystal_r27te4.png
 
okay I saw where I went wrong in the formula. I still have some that didn't group. Here is a sample
70226 separate group
70227 separate group
70237 separate group
70238 separate group
70249 separate
70250 separate

Any ideas
 
Is my formula now the innermost group? Are there any suppressed groups? Do the problems only occur in the first records within the group?

Please show your actual formula and then also show a full sample where the errors are occurring so that the context is apparent.

-LB
 
The formula is a subgroup. No suppressed groups. Not just on first records.
Formula:
numbervar x;
numbervar y := x;
numbervar x := {tblAPInvDistributions.InvDistID};
numbervar z;
if x=y+1 then
z := y else
z := x;
z

Attached image is only showing one page of the issue... 70237 should have been grouped with 70238 and 70249 should have been grouped with 70250
crystal_g44i8o.png
 
Also, do you have and suppression formulaa on the detail section?

-LB
 
Yes it is the innermost group (group 2) and i do not have a suppression formula within the details
 
Change the formula to:

numbervar x;
numbervar y := x;
numbervar x := {tblAPInvDistributions.InvDistID};
numbervar z;
if x=y+1 then
z := y else
(
z := x;
y := 0
);
z

This adds a reset to the value of y between groups. Please let me know if this works for you.

-LB
 
That fixed it...
Thanks so much for your help I would have never have figured it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top