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!

Suppressing duplicates

Status
Not open for further replies.

Rob32

Technical User
Oct 14, 2002
18
NZ
Hi there

My apologies to begin with if this question is a little convoluted...

I am using CR 7, reading out of a SQL database.

I use a formula that concatenates records into one string, and splits the string when it gets close to the 254 char limit. It is as follows:


Code:
WhilePrintingRecords;
StringVar list;
StringVar list1;

If list="" then
list := {reg_product.description}
else If Length(list) <= 150 then
list := list  + &quot;, &quot;  + {reg_product.description}

Else if
list1=&quot;&quot; then
list1 := {reg_product.description}
else
list1 := list1 + &quot;, &quot; + {reg_product.description}


This formula sits in the details section (which is suppressed) and prints to 2 formulae placed in the group footer section:

The first formula is this:

Code:
WhilePrintingRecords  ;
stringVar  list;
stringVar  lastList;

lastList := list;
list := &quot;&quot;;
lastList
//listPrem;

The second formula is this:

Code:
WhilePrintingRecords  ;
stringVar  list1;
stringVar  lastList1;

lastList1 := list1;
list1 := &quot;&quot;;
lastList1

The problem I have is that these formulae do not suppress duplicate entries, and I don't want to be reporting the same product over & over. Duplicates do not necessarily follow each other. I am also using a similar set of formulae in the same report to output processing categories. The old right click->suppress duplicates action does not work on either the first formula or the two smaller one.

Any help would be greatly appreciated - thanks.
 
Are you saying that you have formulas that are dupes, or that the contents within contain dupes?

If it's the contents within the formula that are dupes, perhaps you can use arrays instead of a stringvar and iterate through the array prior to populating it each time to determine if the current one is a dupe. After you've constructed the array, you can parse it in 2 different formulas, based on length, for display purposes.

If the formulas themselves are dupes, I think that there's little to be done here other than ordering the rows differently to determine whether the current formula is identical to the previous().

-k kai@informeddatadecisions.com
 
Thanks for your prompt reply SynapseVampire. I am indeed saying that it's the contents in the formula that are dupes. Your suggestion about using arrays sounds interesting - unfortunatly programming/coding isn't my strong point - do you have anything that can start me off?


Thanks.
 
It's been too long since I used version 7 (CR is at 9 now, with siginificant changes in each .5 release), and it has limitations.

Here's some help with arrays, with some specifics about CR 7 limitations:


The best performance will be from a Stored Procedure in the database.

-k kai@informeddatadecisions.com
 
After a quick look through that document, I can see some definite possibilities. Thanks again synapsevampire.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top