It has always hassled me as to the is the easiest method to perform the following...
having a simple someone to many db, if you have 2 tables/grids on the form and also the second one strained through the first.
where is the greatest spot to place the filter code
procedure TForm1.tblCustormersAfterScroll(DataSet: TDataSet); begin if tblCustormersCustormerID.AsString <> '' then begin tblCustormersThings.Filter := 'CustormerID = ' + tblCustormersCustormerID.AsString; tblCustormersThings.Filtered := true; end; end;
AfterScroll appears to operate more often than not, but donst get fired on some occasions eg after posting. Normally i'd possess a procedure to complete the filter update and set it anywhere it appears to become needed.
But i'm wondering if there's an easy method, this appears like simply stuff delphi ought to know about...
I Dont think it matters but im Using Delphi7 and NexusDB1
You need to set MasterSource and master fields qualities on "many" side.
It's known as Master - Detail relationship, and you ought to seek advice from NexusDB help for the way to crate this relation ship between tables.
In case your table supports indexes, than you may create index on CustomerID as well as use SetRange() method.
How you set Filter may be the slowest one.