Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Consolidate Lines in Crystal Post Reply Post New Topic
Author Message
jspchale
Newbie
Newbie


Joined: 08 Dec 2011
Online Status: Offline
Posts: 5
Quote jspchale Replybullet Topic: Consolidate Lines in Crystal
     Posted: 08 Dec 2011 at 12:20pm
Hello,
 
Can you tell me if you can add two items together on a invoice? For Example:
 
I have a Tax Invoice.
If the product code starting with, or is like "GPSB" and "Labour" is sold (1 line GPSB, Labour next, so 2 lines in totals)
I want Crystal to display 1 line, consolidate them both to display "Certain Text" and sum the quantity and values.
 
If either of these stock products are not sold then display as normal.
 
Do you know if this can be done?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Dec 2011 at 3:05am
Is there always only these 2 row options on the invoice or are there other types of rows that may also appear?

Edited by DBlank - 09 Dec 2011 at 3:06am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 09 Dec 2011 at 3:29am
the next twist is going to be, what if there are different lines (which sounds like there are) are these 2 lines always next to each other, or are other lines between them like:
 
GPSB
something
Labour
 
and can you have multiples of these on the same invoice, like:
 
GPSB
GPSB
Labour
something
Labour
something
 
If either of these scenarios are valid, I think that CR is going to have a hard time finding and suppressing the rows and displaying the values that you want.
 
Depending on your skill level, my suggestion (no surprise to some) is to this in a stored procedure.  There you can easily (well more so than in CR) create and delete the rows / information that you desire, and just return the values to CR that you truly desire.
 
HTH
IP IP Logged
jspchale
Newbie
Newbie


Joined: 08 Dec 2011
Online Status: Offline
Posts: 5
Quote jspchale Replybullet Posted: 10 Dec 2011 at 3:07pm
Yes only ever two lines. Thanks.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 Dec 2011 at 3:25pm
One way,
Group on invoice
Create 2 formulas to flag each row
If field startswith 'gpsb' then 1
If field = 'labour' then 1
Sum each fo these at the group level
Suppress details when both sums = 1
Sum(formula,invoice)=1
Create another formula field to create your text
If Sum(formula,invoice)=1and Sum(formula2,invoice)=1then 'certain text'
Display in group footer next to the sum of your quantities at the group level

Edited by DBlank - 10 Dec 2011 at 3:25pm
IP IP Logged
jspchale
Newbie
Newbie


Joined: 08 Dec 2011
Online Status: Offline
Posts: 5
Quote jspchale Replybullet Posted: 10 Dec 2011 at 5:59pm
Thank you so much for your reply...

Sorry I do not understand what you mean here:
Sum(formula,invoice)=1

The rest of it I kinda get.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Dec 2011 at 1:58am
To get the sum of a field at the group level you have the function(field,group)

Yours will be something closer to
sum({@formula name},{table.invoice})
By adding the =1 it makes it a Boolean formula to return true whenever that value for that a group =1 and false all the other times
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum