Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Crystal Reports XI - formula to remove duplicate records

Posted on 2010-11-29
Medium Priority
1,713 Views
Hello,

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
[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
• 2
• 2
• 2

LVL 101

Accepted Solution

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

Try this idea.

Group by part number

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

James0628 earned 1000 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

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

Author Comment

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

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

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

Question has a verified solution.

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

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 …
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
###### Suggested Courses
Course of the Month5 days, 13 hours left to enroll