Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress Duplicates in Details of GroupH 3 1

Status
Not open for further replies.

brizaybrizoke

Technical User
Jul 21, 2011
25
US
Searched for a previous thread but could not find one/deciper formulas.

I'm using Crystal Reports 8.5

I have three groups.
The only details are in group #3.
Group #3 = AA, BB, CC

How do I suppress duplicates in the proceeding GroupH 3 details?


GroupH 1 - 100
GroupH 2 - Red
GroupH 3 - AA
1
2
3

GroupH 3 - BB
1 (want to suppress)
3 (want to suppress)
4

GroupH 3 - CC
2 (want to suppress)
3 (want to suppress)
4 (want to suppress)


Thanks in advance!
 
Hi,
What are the source fields for the Groups? Is more thsn one table involved?

Usually the records shown within a group value are unique to that group value and not really duplicates.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Do a running total count for each detail-line possibility for the whole report. Make it conditional, based on a formula, something like
Code:
{detail.value} = 1
In the detail line, conditionally suppress when the count is greater than 1. (If you display it, you'll find it will be one for the first occurance, 2 for the next etc.

This will mean creating a running total for each possibility, no helping that, unfortunately.

In 8.5 you can't duplicate, but you can have a dummy report and copy a formula field to it, change its name and copy it back.

It also occurs to me that possibly a Cross-tab would be useful, though it would not show what you have asked for.

If you're not already familiar with Crystal's automated totals, see FAQ767-6524.


[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
What are the actual fields you are grouping on? Is group #3 based on some field that has a sequence to it, e.g., a date? What database are you using?

-LB
 
This is how I have my report grouped/sorted,

Group 1 = {ORDER STATUS} = 301 (suppressed)
Group 2 = {ORDER TYPE} (There are 8 order types)
Group 3 = {ORDER ZONE} = AA, BB, CC

Ultimately, I want a sum of the {TOTAL LINES} of the first {ZONE} that an order exists in (Group 3).
And, a sum of the first sum for all zones for each {ORDER TYPE} (Group 2).

I'm running into problems when I add the third group {ZONE}. All order details that I've previously suppressed are separated and become visible again.

Before creating Group 3 {ZONE}.
Highlighted is the only data I want to see/be summarized.

d2803a1aa8d59194f8c260d5c0bad14df1ecc5232e84c68cf9b851c3949dbf1f4g.jpg


After creating Group 3.

a50039c8fb76a42a5556f7c01853378bd56ebc7eeefac1eb763ccd92e2455f894g.jpg


If the first {TOTAL LINES} for an order exist in AA, then I only care about the {TOTAL LINES} in AA for said order.
If an order exists in BB and CC, then I only care about the {TOTAL LINES} in BB.
I do not want to see/have summarized the remaining {TOTAL LINES} in any proceeding zones for an order, thus, no duplicates.

Thanks in advance and please let me know if you need more information. I am self-taught and our IT department believes Crystal Reports are antiquated.
 
Create a SQL expression {%minZone} like this (field explorer->SQL expression):

(
select min(A.`Order Zone`)
from table A
where A.`Order Status` = table.`Order Status` and
A.`Order Type` = table.`Order Type`
)

Replace "table" with your actual table name. Change the punctuation to match that used with your database. Then add the expression to your record selection formula:

{table.Order Zone} = {%minZone}

-LB
 
I've hit a road bump.

After entering,

SELECT
min(Ordzones."ORDZONES_ZONE")
FROM
Ordzones."ORDZONES_ZONE"
WHERE
Ordhead."ORDHEAD_STATUS" = Ordhead."ORDHEAD_STATUS" and Ordzones."ORDZONES_RCON_TYPE" = Ordzones."ORDZONES_RCON_TYPE"

For my SQL Expression, I receive "ODBC Incorrect syntax near the keyword 'SELECT'."

I have never created a SQL Expression before so I'm not sure what I need to adjust within this query.
 
You should have left the "A's" alone as it represents an alias table that creates the necessary grouping within the expression and you MUST enclose everything in parens:

(
SELECT
min(A."ORDZONES_ZONE")
FROM
Ordzones A, Ordhead B
WHERE
A."LINKING_FIELD" = B."LINKING_FIELD" AND
B."ORDHEAD_STATUS" = Ordhead."ORDHEAD_STATUS" and A."ORDZONES_RCON_TYPE" = Ordzones."ORDZONES_RCON_TYPE"
)

Replace "LINKING_FIELD" with whatever field you are using to link the two tables in your main report.

-LB
 
Okay, I got the SQL Expression to take.

(
SELECT
min(A."ORDZONES_ZONE")
FROM
Ordzones A, Ordhead B
WHERE
A."ORDZONES_ORDNO" = B."ORDHEAD_ORDNO" AND
B."ORDHEAD_STATUS" = Ordhead."ORDHEAD_STATUS" and A."ORDZONES_RCON_TYPE" = Ordzones."ORDZONES_RCON_TYPE"
)

I then put it into my Select Expert.

{Ordzones.ORDZONES_ZONE} = {%minZone}

However, the report is only showing orders with {TOTAL LINES} in AA.

Is there something in the formula or Select Expert that removed the orders whose first {TOTAL LINES} existed in BB or CC?

c9ee90b62f7b5713d621a72f2ac68c4b6102d8ffb09119c454c02a33c613bd3e4g.jpg


For example, all orders un-crossed in the image above should still be visible because the order number does not exist in the previous zone.

Any ideas?
 
Sorry. I think it should be:

(
SELECT
min(A."ORDZONES_ZONE")
FROM
Ordzones A, Ordhead B
WHERE
A."ORDZONES_ORDNO" = B."ORDHEAD_ORDNO" AND
B."ORDHEAD_STATUS" = Ordhead."ORDHEAD_STATUS" and A."ORDZONES_RCON_TYPE" = Ordzones."ORDZONES_RCON_TYPE" and
A."ORDZONES_ORDNO" = Ordzones."ORDZONES_ORDNO"
)

-LB
 
lbass, you've done it again! Thank you so much for your help as always. Now to teach myself how and why that formula works so I can use it in the future.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top