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 conditionally suppressed fields

Status
Not open for further replies.

FL0129

IS-IT--Management
Jan 25, 2012
1
US
Hi,

I have a report that conditionally suppresses fields that contain a specific record. For example:

Record A12345

Sub-record - Open
Subrecord - In Progress
Subrecord - Future


I suppressed all records that have any subrecord that = Future Action. I used the 3 step formula to do this.

Initalize:

shared numbervar x;
x := 0:

Calc:

Whileprintingrecords;
shared numbervar x;

If ({RecordStatus}) = "Future"
then x:= x+1

Show:

shared numbervar x;
x

Next, I suppressed on the group with the following:

{@check} = "*FUTURE*"

the formula for check is

shared numbervar x;
if x> 1
then "*FUTURE*"
else "OPEN"

Everything suppresses PERFECT but now how do I count only the records displayed and not count the suppressed fields?
 
Use the same formula to get 1 or 0. Then sum the result.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
You could do this more simply by creating a formula like this:

//{@hasFuture}:
if {table.recordstatus}="Future" then 1

Then instead of suppression, use group selection. Go to report->selection formula->GROUP and enter:

sum({@hasFuture},{table.record})=0

Then insert a running total that does a distinctcount of the {table.record}, evaluate for each record, reset never (if you want the count at the report level) or reset on change of some higher order group. Place the running total in the footer section.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top