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 of variables without grouping

Status
Not open for further replies.

Stroke

IS-IT--Management
Oct 6, 2003
2
US
I am using Enterprise 8.5 and use the count functionality throughout my reports. However, I am having a difficult time counting values of individual variables without grouping.

Example:

I would like a count of every consumer in region 2 and region 4. The report is already returning all the
information but the header contains counts of regions, but the report does not group (and I do not want to - I use the report body to drill down into different data).

Please help! This is driving me NUTS!

Thanks,

John Stroke
jstroke@migkap.com
 
John Stroke,

You can use the 'Running Total' for this.

Create a new running total and select your field in 'Field to summarize'. Then select Type of summary as 'count'.

Now see the 'Evaluate' option. You may select formula so that it it will be counted only in region 2 and region 4

Example {location.region} in ["Region2", "Region4"]

Place it in the report ( just like any formula )

Hope this helps
 
kutoose - not sure your approach works when the data is not grouped.

John - Do you want the count in the report header?? How about the Report Footer??

Place the following formula in the report header

//@initialize (suppressed in the report header)

WhilePrintingRecords;
numberVar Region2count := 0;
numberVar Region4count := 0;

Now in the detail section put the formula

//@CountRegion2/4 (details suppressed)

WhilePrintingRecords;
numberVar Region2count ;
numberVar Region4count ;

if {table.region} = 2 then
Region2count := Region2count + 1;
if {table.region} = 4 then
Region4count := Region4count + 1;

Then in the Report Footer place the following formula to display the results

//@DisplayRegionCounts

WhilePrintingRecords;
numberVar Region2count ;
numberVar Region4count ;

"The customer count for Region 2 : " + totext(Region2count,0) + chr(13) + chr(10) +
"The customer count for Region 4 : " + totext(Region4count,0) ;

I am assuming that each record is a different customer your problem statement does not indicate this is not the case.



Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top