Print Page | Close Window

Suppressing duplicates

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=1290
Printed Date: 27 Apr 2024 at 9:49am


Topic: Suppressing duplicates
Posted By: BamaJohn
Subject: Suppressing duplicates
Date Posted: 07 Sep 2007 at 12:00pm
I've got a billing statement in CR XI R2 where I'm showing the client invoice data in Detail band A, payment/adjustment info in Detail band B.  Both detail bands have an "INVNO" (invoice number) field.  I have both INVNO fields set to suppress duplicates.  I have to have the INVNO in both bands because there are companies with only payment info, no invoice info, and they need to see which invoice the payment applies to.  Likewise I have invoices with no payment info. 
 
The issue I'm trying to handle is when I have both invoice and payment info and I wind up with two copies of the INVNO showing on the report, one on the first line of Detail band A, one on the first line of Detail band B.  Is there some way to conditionally suppress INVNO in band B based on band A being non-empty?   These bands are inside an INVNO group, so I know I'll only have the same INVNO in both bands.
 
Thanks for your help!



Replies:
Posted By: BrianBischof
Date Posted: 07 Sep 2007 at 12:28pm
I would take the conditional formatting formula that enables Details A to be displayed and copy that to the Suppress property of InvNo field in Details B. That way, whenever Details A gets enabled, then the second InvNo field will be disabled.

Hmmm... re-reading your question that might not work. Not sure how your data is setup. Another idea is to use the PreviousValue() function to look at the previous record in the report. If it's InvNo matches the current InvNo then disable the field (again, using conditional formatting for the Suppress property of that field). This might be the best solution depending upon how I interpret your question.


-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: BamaJohn
Date Posted: 07 Sep 2007 at 1:02pm
Thanks very much for the quick response.
 
I just tried both suggestions, which seemed to hold a lot of promise.  Unfortunately, neither worked.
 
My detail bands are both based on the same view, we can call it dvStatementDetail.  When dvStatementDetail.GroupType='ADJ' it's a payment/adjustment line and I suppress band A.  When it's ='DETAIL' it's an invoice detail line and I suppress band B.  Putting the conditional suppress formula from band A into band B's INVNO suppress makes it always suppress that field.
 
When I tried the other suggestion, having the suppress tied to Previous(dvStatementDetail.INVNO)=dvStatementDetail.INVNO, it didn't ever suppress the second INVNO. 
 
I thought of something, though--I see each item on the report in XI R2 has an "Object Name" associated with it.  Is there any way to refer to fields within a suppress formula based on that?
 
If it weren't for the ones where all the activity for the month is payment/adjustment activity I could just leave the second INVNO off.


Posted By: jkwrpc
Date Posted: 07 Sep 2007 at 1:28pm
I know this is a simple suggestion, but can you suppress based on a count of GroupType?  So if there are no records for ADJ or Detail the appropriate band is suppressed.
 
I am coming in late to conversation, and confess I am still trying to better understand the issue.  My apologies if I am missing the point.
 
Regards,
 
John W.
http://www.CustomReportWriters.net - www.CustomReportWriters.net
 
 


Posted By: BrianBischof
Date Posted: 07 Sep 2007 at 1:35pm
I think the second idea of PreviousValue() should work. What I would do is actually PRINT the PreviousValue() function in Details B just to see what value it is returning. That might clear up why it always prints. Once you see the actual data that is being compared, things will probably make more sense. It's probably something simple that you're missing and you'll have one of those "ah ha!" moments when you look at the raw data.

Secondly, what is "Object Name" and why do you think this will help? Somehow, I don't think I've ever seen this before and I'm a bit curious as to how I missed this "Object Name" property.

Another question, what is the Group field? Can you just put the InvNo at the bottom of the Group Header section so that it only prints one time? Ok, here is one more idea: Create a new Details A section (shift the other ones down) and ONLY put the InvNo field in it. Then set the Suppress formula to be PreviousField() on the grouping field. That way the InvNo only prints for the first record in that group.

One of these ideas should get you going. Remember, when all else fails, print out all the data in your formulas in the section so that you can see what CR is doing behind the scenes (I even put the Suppress formula in its own formula just so I can print that out and test when it is True or False). Seeing raw data makes everything clear.


-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: BamaJohn
Date Posted: 07 Sep 2007 at 2:06pm

Well, the suggestion of printing the value worked. 

Previous(dvStatementDetail.INVNO) was always coming out blank.  However, when i examined Previous(dvStatement.INVNO) (the parent record), it was giving values that would work to suppress properly.

So my final suppress formula was:
Previous(dvStatement.INVNO)=dvStatementDetail.INVNO
 
Worked like a champ!  Thanks for the ideas and the help!



Print Page | Close Window