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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress if the above column is duplicated 2

Status
Not open for further replies.

HoosHot

Programmer
Jan 16, 2003
41
US
Hi,
Here is some sample report data (example 1):
id col1 col2 col3 col4
-- ---- ---- ---- ----
1 abc def ghi jkl
1 abc def hij jkl
1 abc def ijk jkl
2 abc def ghi jkl
2 abc def klm jkl

I would like it to look like this instead (example 2):
id col1 col2 col3 col4
-- ---- ---- ---- ----
1 abc def ghi jkl
hij
ijk
2 abc def ghi jkl
klm

If I format these fields and click on the "suppress if duplicated" box, I would get something like this (example 3). I do not want this:
id col1 col2 col3 col4
-- ---- ---- ---- ----
1 abc def ghi jkl
hij
ijk
2 ghi
klm

Basically, I want to "supress if duplicated" when the id's change.

Thanks so much in advanced :)
mnguyen_va@yahoo.com
 
Don't use suppress if duplicated.
Use the regular suppress with a condition formula:

ID = Previous(ID) Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Hi Ken, Again, thanks for all your help/guidance!

I tried what you did and for the most part, everything looks great.

However, here is some same sample report data (before any supressing):
id col1 col2 col3 col4
-- ---- ---- ---- ----
1 abc def jkl
2 bcd efg ghi klm
2 bcd efg hij klm

Here is my desired output:
id col1 col2 col3 col4
-- ---- ---- ---- ----
1 abc def jkl
2 bcd efg ghi klm
2 hij

When I suppressed co1, col2, and col4 with a condition formula of:
{id} = Previous ({id})
here is my output:
id col1 col2 col3 col4
-- ---- ---- ---- ----
1
2 bcd efg ghi klm
2 hij

I'm not sure why Crystal supressed col1, col2, and col4 of my first record.

Basically, if it's the first record/row of the id, it should display all the columns. Only when it is a duplicate id should it start supressing if the data, as compared to the data in the duplicate id above it.

Again, thanks so much for your help :)
mnguyen_va@yahoo.com
 
I know why, the first record doesn't have a previous so the formula crashes.

Try either of the following:

Not OnFirstRecord and ID = Previous(ID)

or an alternate:

If OnFirstRecord
then False
else ID = Previous(ID) Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Ken,

Again, thanks for your help! This last solution worked great! :)
 
Hi again,

Let me add some more variables into the equation:

Here is some same sample report data (before any supressing):
acct id col1 col2 col3 col4
---- -- ---- ---- ---- ----
555 1 abc def jkl
555 2 bcd efg ghi klm
555 2 bcd efg hij klm
666
777
888 3 cef ghi jkl mnp
888 4 efg hij klm npq

Here is my desired output (I have a new grouping/page on acct):

acct=555
id col1 col2 col3 col4
-- ---- ---- ---- ----
1 abc def jkl
2 bcd efg ghi klm
2 hij

acct=666
id col1 col2 col3 col4
-- ---- ---- ---- ----

acct=777
id col1 col2 col3 col4
-- ---- ---- ---- ----

acct=888
id col1 col2 col3 col4
-- ---- ---- ---- ----
3 cef ghi jkl mnp
4 efg hij klm npq


Using Ken's advice of:
Not OnFirstRecord and ID = Previous(ID)
or an alternate:
If OnFirstRecord
then False
else ID = Previous(ID)

everything works great (before i noticed some "bugs"). This is what I get when I use either of the above formulas:

acct=555
id col1 col2 col3 col4
-- ---- ---- ---- ----
1 abc def jkl
2 bcd efg ghi klm
2 hij

acct=666
id col1 col2 col3 col4
-- ---- ---- ---- ----

acct=777
id col1 col2 col3 col4
-- ---- ---- ---- ----

acct=888
id col1 col2 col3 col4
-- ---- ---- ---- ----
3
4 efg hij klm npq


Notice on acct=888, id=3's col1,col2,col3,col4 is not showing up because the formula says supress it if:
Not OnFirstRecord and ID = Previous(ID)

Notice the id before id=3 (acct=888) is <null> (acct=777). This is why id=3's col1,col2,col3,col4 is not showing up.

Can you help me revise my formula?

Thanks a bunch! :)
 
Hi;

Rather than key everything off of the ID field, each column field (including ID) shuld be suppressed based on its own previous value.

ie. for column1 the suppress formula would be based on the previous {field col1}

now your problem is also that you do not want to suppress if the group has changed...so that becomes part of the formula as well

this is a single example of a conditional suppress that should be applied to each field in the detail line

******************** start of formula ************

// add this unless you are summing the field
WhilePrintingRecords;

not previousIsNull({field}) and previous({field}) = {field} and not previousIsNull({@Group1name}) and previous({@Group1name}) = {@Group1Name}

******************** end of formula ************


this might do the trick...fill in the appropriate values for {field} for each column..including ID and the appropriate GROUP1Name

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top