Solved

Crystal Reports XI - formula to remove duplicate records

Posted on 2010-11-29
6
1,663 Views
Last Modified: 2012-05-10
Hello,
can someone please help me to create this formula in order to remove duplicate records.

I have Part Number, Formula A and Formula B.

Formula A states:
if Code='A' then show value from VALUE field

Formula B states:
if Code='B' then show value from VALUE field

Both of these formulas as in my report details

so the output will create 2 records to each part.

e.g.
line 1: |Part 123|  Coke| 'blank'|
line 2: |Part 123|  'blank'| 'Cisco'|

how can I combine these 2 lines so that it will show only data like this:

line 1: |Part 123|  Coke| Cisco|


thank you
0
Comment
Question by:Palmer_Admin
  • 2
  • 2
  • 2
6 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 250 total points
ID: 34234014
Are the lines separate records?

Try this idea.

Group by part number

In the group header add a formula
WhilePrintingRecords;
Global StringVar strpartA;
Global StringVar strpartB;
strpartA := "";
strpartB := ""

In the detail section add a formula
WhilePrintingRecords;
Global StringVar strpartA;
Global StringVar strpartB;
If {CodeField} = "A" then
    strpartA := {ValueField};
If {CodeField} = "B" then
    strpartB := {ValueField};
""

Remove the fields from the details section except the above formula
You can then suppress the detail section if blank

In the group footer
Put the fields you want to display
Add 2 formulas to display the strings
WhilePrintingRecords;
Global StringVar strpartA;
strpartA
 
WhilePrintingRecords;
Global StringVar strpartB;
strpartB

mlmcc
0
 
LVL 34

Assisted Solution

by:James0628
James0628 earned 250 total points
ID: 34236792
Another approach:

 Group on the Part Number and suppress the detail section.  Put FormulaA and FormulaB in the detail section.  Right-click on each formula and select Insert > Summary and put a Maximum summary for each formula in the group footer.  I think that should work, and it's a bit simpler than using variables.

 James
0
 

Author Comment

by:Palmer_Admin
ID: 34239300
thank you guys for your help

James, I can't use FormulaA as Insert Summary field. it is not letting me to grab it as an option.

mlmcc, i still get duplicates, is there a another way?
also, can it be done without grouping?

Will the Alias work in this case?


thanks
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Palmer_Admin
ID: 34239693
my problem is that my part #'s keep repeating because there are order by date as well, so when I try to group it the data is off
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 34239916
Unless you can sort them so the duplicates are together there is no easy way since the records aren't duplicates in the sense that all fields are not the same.

You may have to group based on enough fields so that the "duplicate" records are grouped together.

mlmcc

0
 
LVL 34

Expert Comment

by:James0628
ID: 34245658
 > I can't use FormulaA as Insert Summary field.

 In your original post, you said that Formula A was:

if Code='A' then show value from VALUE field


 If it really is as simple as "if {field1} = 'A' then {field2}", then you can do a summary on it.  If Formula A or B is not that simple, it may affect your options, and the solution, so we'd need to see the exact formulas.

 James
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now