Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: How to overwrite duplicate values Post Reply Post New Topic
Author Message
Novus
Newbie
Newbie
Avatar

Joined: 12 Dec 2011
Location: United Kingdom
Online Status: Offline
Posts: 2
Quote Novus Replybullet Topic: How to overwrite duplicate values
     Posted: 12 Dec 2011 at 6:12am
Hi there,
 

I have a problem where for reasons cannot be changed, I’m getting duplicate data in a group.

I need to overwrite the values of the duplicate quantities and values/invoice amount to zero.

 

Does anyone know how to do this?

 

Example:

 

Invoice No.

Invoice Line

Invoiced Qty

Invoice Line Amt.

567506

1

8.00

83.04

567506

1

8.00

83.04

567506

2

2.00

20.76

567506

2

2.00

20.76

 

 

20.00

207.60

 

 

Resolution:

 

Invoice No.

Invoice Line

Invoiced Qty

Invoice Line Amt.

567506

1

8.00

83.04

567506

1

0

0

567506

2

2.00

20.76

567506

2

0

0

 

 

10.00

103.80

 

 

Thank you.

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Dec 2011 at 7:16am

you can suppress the duplicate detail rows using

previous(table.invoiceno)=table.invoiceno and
previous(table.invoiceline)=table.invoiceline
 
or you can use the same logic to alter the display data to to a zero value.
you cannot use it to uinsert a fomrula field that will allow you to sum on.
you will have to get your values via shared variabl formulas or Running Totals
I pferer RTs.
here are 2 examples
name=qty
field to summarize=invoiced quantity
type=sum
evaluate=use a formula (you could also do this by extra hidden grouping if you want)
previous(table.invoiceno)<>table.invoiceno and
previous(table.invoiceline)<>table.invoiceline
reset= on change of group (invoiceno if you are grouping here) or never if this is the grand total for a report
place in group footer or report footer depending on above reset design answer.
 
name=amt
field to summarize=invoiced line amount
type=sum
evaluate=use a formula (you could also do this by extra hidden grouping if you want)
previous(table.invoiceno)<>table.invoiceno and
previous(table.invoiceline)<>table.invoiceline
reset= same as above
 
 
IP IP Logged
Novus
Newbie
Newbie
Avatar

Joined: 12 Dec 2011
Location: United Kingdom
Online Status: Offline
Posts: 2
Quote Novus Replybullet Posted: 13 Dec 2011 at 1:14am
Hi there,
 
 
Thanks for your quick response.
However my if then else statement returns boolean instead of values.
 
Formula as follows:
 
Local NumberVar NewVal;
 
if previous({L02DCS_GRN_Accrual_v6__Summary.APInvDtl.InvoiceNum}) = {L02DCS_GRN_Accrual_v6__Summary.APInvDtl.InvoiceNum} and
previous ({L02DCS_GRN_Accrual_v6__Summary.APInvDtl.InvoiceLine})={L02DCS_GRN_Accrual_v6__Summary.APInvDtl.InvoiceLine}

then newVal=0 else newVal={L02DCS_GRN_Accrual_v6__Summary.APInvDtl.ExtCost};
 
Do you know how to change it to display 0 if invoice number and line are duplicated and return invoice value if it relates to a unique invoice number and line.
 
 
Thanks indeed.
 
Novus
 
 
 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Dec 2011 at 7:00am
add
NewVal;
to the end of the formula
 
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