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

Count random entries 1

Status
Not open for further replies.

YANKRAY

Technical User
Nov 7, 2003
283
Using CR 10.0

I have data that is grouped by customer.
There is a field in the database that is filled in for SUPPLIER.

This field is random, meaning it could be null, or it could have any number of different Supplier names.

I would like to produce a count of the supplier names (whatever they may be and to include the null value'd suppliers) for each group.

There is some logic to the SUPPLIERS names. The logic is that some of the names are defined by coding in the report, some are null, and some are randomly provided but in that randomly provide number some are "for sure".

So what I want to do is rename the suppliers for the purpose of counting them by group. The Counted groups I need are:

Those with Supplier = VENDOR
Those with Supplier = PEMCO
Those with Supplier = (null value)
Those with Supplier = GFM
Those with Supplier = (any other value)

I cannot do any other grouping on the report because the grouping will become the primary sort order and this cannot happen in the result. I am only looking for totals at the current group level.

Can anyone help?

Ray
 
You can do it as a group within the current group, though it will re-order the detail lines by supplier. Failing that, you'd need to do it as a subreport that groups the same record by supplier.

In either case, you'd need a formula field to use as the basis for grouping. Something like
Code:
if isnull(Supplier) then "4) Null" 
else if Supplier = "VENDOR" then "1) Vendor"
else if Supplier = "PEMCO"  then "2) Pemco"
else if Supplier = "GFM" then "3) GFM"
else "5) Other"
The leading numbers give you control of the sequence.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
You could create a formula {@supplier}:

if isnull({table.supplier}) then "Unspecified" else
if {table.supplier} = "VENDOR" then "Vendor" else
if {table.supplier} = "PEMCO" then "Pemco" else
if {table.supplier} = "GFM" then GFM" else
"Other"

Place this in the detail section and then create five running totals which use count of {@supplier}, evaluate using a formula:

{@supplier} = "Unspecified" //change this in each rt

Reset on change of group.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top