Jump to content
Server Maintenance This Week. ×

Seeking help building a list


This topic is 6186 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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 by Guest
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 6186 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.