dpfmp Posted March 4, 2019 Share Posted March 4, 2019 Hi, I have 2 uniDbGrids in a M/D relationship. UGrid_Factures is the master table: procedure THistoriFact_F.UGrid_FacturesSelectionChange(Sender: TObject); begin if Assigned(UGrid_Factures.DataSource) then begin with UGrid_Factures.DataSource.DataSet do begin FactLigneTB2.Filtered := False; FactLigneTB2.SetRange([Fields[0].AsLongWord,Fields[4].AsInteger], [Fields[0].AsLongWord,Fields[4].AsInteger]); FactLigneTB2.Filter := 'DateFact >= ' + IntToStr(Trunc(_DtA)) + ' and DateFact <= ' + IntToStr(Trunc(_DtZ)); FactLigneTB2.Filtered := True; end; end; end; Everything is ok if the number of rows in the FactLigneTB2.SetRange (detail table) is different than the one from the previous master record. I've read something related to that but it was back in 2011. Is this still a known issue? Is there a workaround? Thank you, Denis Prince D10.1 UniGUi 1.70.0.1486 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 5, 2019 Share Posted March 5, 2019 5 hours ago, dpfmp said: Everything is ok if the number of rows in the FactLigneTB2.SetRange (detail table) is different than the one from the previous master record. I've read something related to that but it was back in 2011. Is this still a known issue? Is there a workaround? Hello, Can you make a simple testcase for this? Quote Link to comment Share on other sites More sharing options...
dpfmp Posted March 5, 2019 Author Share Posted March 5, 2019 Hi Sherzod, Thank you again for your attention, I have built a very simple testcase that shows the problem. If you select from the master grid a record that has the same number of detail lines as the previous one, the detail grid does not refresh and the data is related to the previous master record. You will need NexusDB database engine ( I use an embedded server ). If you need more information, please let me know, Denis Prince TestCase.7z Quote Link to comment Share on other sites More sharing options...
dpfmp Posted March 5, 2019 Author Share Posted March 5, 2019 Using a Refresh on the detail grid seems to do the trick. if Assigned(UniDbGrid1.DataSource) then with UniDbGrid1.DataSource.DataSet do begin DetailsTB.SetRange([Fields[0].AsLongWord], [Fields[0].AsLongWord]); UniDbGrid2.Refresh; end; Quote Link to comment Share on other sites More sharing options...
zilav Posted March 5, 2019 Share Posted March 5, 2019 strange filter method, why not dataset.onfilterrecord? Quote Link to comment Share on other sites More sharing options...
dpfmp Posted March 5, 2019 Author Share Posted March 5, 2019 I believe using a range has a much better performance than using a filter. (NexusDB) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.