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

Suppress if Duplicated

Status
Not open for further replies.

computerman29651

IS-IT--Management
Aug 28, 2006
51
US
I need to know how to make data that displays on the report be suppressed if it is duplicated.

For example,

Jack B, Sue L, Chris P, Ted V, Jack B, Sue M, Ted V, Chris R, Chris P, Mike N, Mike N

I need the information to display on the form like this,

Jack B, Sue L, Chris P, Ted V, Sue M, Chris R, Mike N

Does anyone know how to perform this?
 
I have tried just checking the Suppress if Duplicate, but that does not suppress anything.
 
How did you arrive at this display? If you used a variable to collect these names, then change the accumulation formula to:

whileprintingrecords;
stringvar x;

if instr(x,{table.name}) = 0 then
x := x + {table.name} + ", ";

-LB
 
What exactly does this formula do? What is 'instr'? This almost has the report doing what I need for it to do, but the entire list does not display.
 
I assumed that this referred back to your post of September 18--so yes, you need a reset formula and a display formula also. Instr() tests to see if the value is already in the string, and if it is, it provides the position where the first character starts--so if it is 0, it isn't in the string. If a name meets this criterion, it is added to the string.

-LB
 
Here are the formulas I have been work with:

Display:
whileprintingrecords;
stringvar x := x + {FLATDATA.ANAM} + ", ";

Reset:
whileprintingrecords;
stringvar x := "";

Footer:
whileprintingrecords;
stringvar x;
left(x,len(x)-2)

I think your formula

whileprintingrecords;
stringvar x;

if instr(x,{FLATDATA.ANAM}) = 0 then
x := x + {FLATDATA.ANAM} + ", ";

would work better in my footer, but I am not sure if the display and reset are done correctly on my end. As of right now my entire list is not showing up on the report.

Do you have any suggestions?
 
No.

whileprintingrecords;
stringvar x;

if instr(x,{FLATDATA.ANAM}) = 0 then
x := x + {FLATDATA.ANAM} + ", ";

...replaces:
whileprintingrecords;
stringvar x := x + {FLATDATA.ANAM} + ", ";

...which is the accumulation formula, NOT the display formula, and it belongs in the detail section. The display formula belongs in the footer:

whileprintingrecords;
stringvar x;
left(x,len(x)-2)

-LB
 
The report is still not displaying correctly. The data is just being added to

For example,

Chris
Chris, Ted
Chris, Ted, Mary, etc...

Is there something wrong with my @reset? I have my @reset in the detailed section as well...is that alright? The only two things that are in the detailed section are @accumulation and @reset. Then I have the detailed section surpressed.
 
Let me better explain

Each smaple holds different information.

In the first sample the information may be

Chris, Ted

In the second sample the information may be

Chris, Mary

In the third sample the information may only be

Ted

However, the report is just adding to the next sample such as

Chris - First Sample
Chris, Ted - Second Sample
Chris, Ted, Mary - Third sample

Do you see what I am trying to say?
 
Reset belongs in the group header. If you take a look at the first formula, it sets x := "" or an empty string. You want that to happen at the beginning of each group, therefore, it belongs in the group header.

The accumulation formula which sets x = to itself + the name in the current record, belongs in the detail section where the names appear in each row. This formula should be suppressed--it is just collecting the names for the display in the group footer.

The group footer references x only, and doesn't add anything to it, in order to display the final result of the accumulation formula. It also removes the final comma for display purposes.

-LB
 
Try 3 formulas of:

Details:
whileprintingrecords;
stringvar x := x + {FLATDATA.ANAM} + ", ";

Group Footer
whileprintingrecords;
stringvar x;
left(x,len(x)-2)

Right click the Group Footer and select insert section below and use the folowing formula in the lower Group Footer section (suppress this section):

Reset:
whileprintingrecords;
stringvar x := "";

Please don't use descriptives such as reset and display for your formulas, state WHERE they are located, we don't what sections you decided to place them in.

-k
 
No, why not just try it?

The reason why I've switched is that LB poined out that when you turn on repeat group header for the section the formula gets evaluated again at each page start and throws the totals off, so this ALWAYS gets around the issue whether you're using repeat groupheader or not.

-k
 
To clarify for you, think of a group around th details as a loop, so when you start a group the details start processing, when the details end for that item of the group, the group footer fires, so displaying in the first group footer shows your value, then you reset in the second group footer, so it's the same functionality as resetting in the group header, and the variable doesn't need to be reset at the first go of it because it's at nothing at that point.

-k
 
I understand what you are saying now. I did as you recommended, and everything seems to be working fine. Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top