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

Conditional suppressing of duplicate values

Status
Not open for further replies.

kamm

Programmer
Dec 4, 2000
17
GB
I am trying to suppress duplicate values in a report, however the value I want to display comes from another column in the database.

I have duplicate values in my query and the two fields that I am interested in are a date and an amount. I want to find the duplicate dates and suppress the corresponding amounts. I cannot suppress on the amount as there could genuinely be duplicate amounts but there cannot be duplicate dates.

At the moment I am collating and displaying all the results using two formulas:
In the details section:
-----------------------
WhilePrintingRecords;
StringVar ResultMC;
StringVar Warning;
if {po.po_id} = {@PONumber} then
(
if length(CStr({mc.mc_amount}))+length(ResultMC) >= 255 then
Warning:= "Warning: some data is missing"
else
ResultMC:= ResultMC + "MC Amt: " + CStr($({mc.mc_amount})) + chr(13);
);

ResultMC

-----------------------

In the report footer section:
-----------------------
WhilePrintingRecords;
StringVar ResultMC;

ResultMC;
-----------------------

I think I need to check if the date is a duplicate and then add (or not add - if the date is a duplicate) the corresponding amount to the string which is being built in the details section.

I am going round in circles at the moment so any help would be greatly appreciated...
Thanks
 
I'm not sure I understand how the date affects (or is affected by) either of those two formulae, as no reference is made to a date field or variable.

However, if you're ordering by the date field, you could get away with conditionally suppressing the Amount field with:

{date} = previous{date}

If you need to have the adding up formula check for dupe dates, then (again, if you're ordering by date) your first few lines of formula change to:

WhilePrintingRecords;
StringVar ResultMC;
StringVar Warning;
if {po.po_id} = {@PONumber} then
if {date} <> previous (date) then
...

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top