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!

Group Selection Formula problem

Status
Not open for further replies.

cinbh

MIS
Apr 16, 2002
58
US
We are using Crystal 8.5 with VFP 7.0. My enduser needs a report that shows all customers that have ordered a product line but only those who have NOT ordered a particular product of both that product Line or other product lines. Example: Maker is the Product Line

Cust A has ordered 20 cars (of asstd Makers) and has ordered 10 Trucks of which 5 are Chevy 5 are Fords.

Cust B has ordered 5 cars and has ordered 10 Trucks 2 are Chevy, 5 Fords and 3 Toyotas.
Of the above example my enduser only wants to see the detail info of the customer who has NOT ordered the Toyotas.

Hopefully this is a clear enough example.
Thanks, Cin
 
Still a little unclear. Are you saying you want to select only those customers who have ordered both Chevys AND Fords and not Toyotas? Or if someone had ordered a Chevy (or a Ford) and a Toyota would they be excluded too? In other words, what are the criteria for INCLUSION?

-LB
 
I've made it a little to simplistic initially. I should have added in the type of transmission.

My enduser wants to call any customer who has ordered any Chevy's 2WD or 4WD, Ford's 2WD or 4WD, and Toyotas 2WD , and offer a new deal on only 4WD Toyota's, but if the customer has already ordered a 4WD Toyota they would not need to be called. This data is stored in the groupings of makers- Chevy, Ford, Toyota, so I have to select these groups, but where it gets sticky is excluding based on the transmission type and maker Customer C. So I assume I need a group record select but not exactly sure how to set up the grouping formula to find.

Cust A has 20 cars (asstd makers) 10 Trucks - 5 Chevy 2WD & 5 Fords 4WD.

Cust B has 5 cars, 10 Trucks - 2 Chevy 2WD, 5 Fords 2WD & 3 Toyotas 4WD

Cust C has 2 cars, 5 Trucks - 2 Toyota 2WD and 3 Toyota 4WD

Cust D has 2 Trucks - 2 Toyota 2WD

Of the customers above my enduser would call only customer A & D

Hopefully this helps a bit
Cin
 
I would start by using a record selection formula like:

{table.maker} in {"Chevy", "Ford", "Toyota")

Then group by customer ID. Next create a formula {@makertrans}:

if {table.maker} = "Toyota" and
{table.trans} = "4WD" then 1 else 0

Place this in the details section. Then go to report->edit selection formula->GROUP and enter:

sum({@makertrans}, {table.cust}) = 0

This will return only those customers who have not ordered Toyota 4WDs.

Let me know if you cannot limit your records to the three makers--this solution can be adapted if that is the case.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top