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!

Summing a Boolean Column

Status
Not open for further replies.

Datapac

Technical User
Mar 15, 2004
4
IE
I've created a report over 2 tables, REQUEST and TASK. There can be many TASKS for each REQUEST. I've added a formula field into my report to indicate whether a REQUEST was completed in a single TASK.

@RequestFirstTime
if Count ({TASK.TASK_ID},{REQUEST.REQUEST_ID} ) = 1 then 1 else 0

I want to add a Total Requests finished First Time value to my Report. I've tried the following:

@TotalRequestFirstTime
sum({@RequestFirstTime})

Unfortunately this doesn't work, I think it's because of the combination of SUM and COUNT in the 2 formulas.
Any ideas?
 
I've figured it out ... I'm using the 3 formula approach

//{@reset} placed in the group header
whileprintingrecords;
numbervar total := 0;

//{@sumonce} placed in the detail section:
whileprintingrecords;
numbervar total := total + ({@RequestFirstTime});

//{@displtotal} placed in the report footer:
whileprintingrecords;
numbervar total;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top