May 19, 200718 yr 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, 200718 yr by Guest
May 20, 200718 yr 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.
Create an account or sign in to comment