delphi - ADOQuery Master/Detail -


How do I set up ADOQ to filter the data to display all the lakes with Brook Trout in DBgrid?

Data:

Nate Pond - LakeMaps Lake_name

  brook trout - species. Blackbird Black Pond Black Trout Brown Trout Brown Ballhead Common Shiner Lake Placid   

Black Pond

  Bru Trout Brown Ballhead Common Shiner  

Lake Placid

LakeTroutShortmouthAdotable1 = LakeMaps LakeMaps.Field [0] LakeMaps <0> = Lake_ID: Autonumber ---] species expansion

relationship

  lekmaps Field [1] = lake_name: text --- | | Setting connection to the species table in the admissions database. Species.fild [0] = species_id: numeric --- species.fild [1] = species_name: text  

species table is an extension of Lekmaps Master

Filtration Data:

Nate Brown Trout Brown Ballhead Normal Shiner

< You can set the filtering = true and then OnFilterRecord / Code> event and if extension dataset value is included, check request (this loop Dataset Process)

This will probably be very slow on the big amount of information. In those situations, I usually filter directly the master record in SQL. Choose something like this:

  Choose from LakeMaps in Lake_ID (select Lake_ID from within the species) on SpeciesLakesRelation (Species.Species_ID = SpeciesLakesRelation.Species_Id) SPECIES_NAME = 'Brook Trout')  

This SQL has returned a record from the lakes which is 'Brook trout'

is the list of species by which the link between the lakemaps and the species is related.


Comments