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

Count Displayed Records Only (Do not count records in supressed sectio

Status
Not open for further replies.
Jun 13, 2003
20
US
Could someone please tell me how I can count (distinct count) the records that are displayed on the report (not counting records that are supressed). I do not want to count the records that are in the details section and are supressed in the Section Expert based on a certain condition. I would like to display the totals for only those records that show up (display) on the report. Thank you in advance.
 
Insert a binary formula that uses the same criteria as your Supress formula in the Section expert, then sum the binary formula.

EXAMPLE : IF {Table.Pet} = "Dog" THEN 1 ELSE 0

This would give you a field that you could use to count all your dogs...
 
What is your logic for conditional suppression? You can use the same logic to create a counter formula. For example, if your suppression logic is:

{myField} < 0

then create a formula such as:

If myField < 0 then 1 else 0

Place the formula in the details section (and suppress its display) and then sum the formula field at whatever level you need to (group, report footer).

There are other approaches as well, if you want a more elegant solution. And, it gets more complex if your suppression uses &quot;WhilePrintingRecords&quot; or, by virtue of it's references it ends up being a 2nd pass formula. However, you can still create a formula that will allow you to count displayed items even if your suppression logic is 2nd pass.
 
Just noticed your DistinctCount need, you may need to adapt the binary formula.

Please post some sample data with headers, and an example of how you would like it displayed.
 
My supressed data is based on the following formula:

if {patch.name} = {?sp} then true
else false

I am supressing based on parameter. Is this going to cause issues?
 
No, but as MJRBIM asked, please post sample data and how you would like the result displayed. If you need distinct counts, what field are you basing the distinct on?
 
Try using the running total editor. Select the field you want to count, choose distinctcount, evaluate based on a formula and in the formula area enter:

{patch.name} <> {?sp}

Reset never or on change of group, depending on whether you want your total at the report or group level.

To evaluate correctly, the running total needs to be placed in the report footer or in the footer of your group if you are resetting on change of group.

-LB
 
rather than conditionally suppressing data, why not exclude it from the report altogether with a record selection formula? This way you do not have to worry about any summary operations you have, they will work fine.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top