Solved

Crystal Reports XI - formula to remove duplicate records

Posted on 2010-11-29
6
1,701 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 101

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 35

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
[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

 

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 101

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 35

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

636 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