Rockxyzzy Posted May 19, 2007 Posted May 19, 2007 (edited) Hello! Thanks in advance for any help that y'all can offer. I'll try to keep it simple and illustrate my problem with a contrived example. I have a set of records from a veterinary clinic for dogs. Each record contains the dog's name, the owner's name, and the breed of the dog. Because the system is structured from the perspective of the patient (the dog), there's a record for each dog. Because a person can own multiple dogs, there might be more than one record that contains the name of a given owner. I need to be able to create a query dialog for a user to enter a specific breed of dog and get a list of everyone who owns a dog of that breed. But, if a person owns more than one dog of a given breed, I only want to see their name on the list once. I don't care how many of a given breed a person owns, I just want a list of unique owners of a given breed. I've tried this with the List function and with summary/sub-summary reporting and I can't figure out how to avoid duplicate entries for those people who have more than one dog of a given breed. How might I attack this? Edited May 19, 2007 by Guest
Genx Posted May 20, 2007 Posted May 20, 2007 Okay, assuming that you have two tables: People Table PersonID PersonName g_breedType ( a text field with storage set to global under field options to accept your query ) Dogs Table OwnerID DogID DogBreed ... and assuming you've related your dogs to your people via PersonID=OwnerID From your people layout perform a search as such: Show Dialog[ Enter a breed ; Field: PeopleTable::g_breedType ] Enter Find Mode[] Set Field[DogsTable::DogBreed; PersonTable::g_breedType] Perform Find[] If[Get(LastError) <> 0 ] Show Dialog[ Error ; no dogs found matching specified breed] End If You will then be left with only the people with one or more dogs of your specified breeds.
Rockxyzzy Posted May 20, 2007 Author Posted May 20, 2007 Thank you for your response. I'll jump into this and see how it goes!
Recommended Posts
This topic is 6455 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now