lcolombo Posted April 23, 2019 Share Posted April 23, 2019 I have a table (DataSet) with approximately 80.000 records. The table is shown with a paged UniDBGrid and the time it takes is "normal". But if I add a lookup field to the Dataset, the loading time is multiplied by approximately 7. Any advice ? Any ideas ? Regards, Quote Link to comment Share on other sites More sharing options...
lcolombo Posted May 2, 2019 Author Share Posted May 2, 2019 Any advice ? Any ideas ? Quote Link to comment Share on other sites More sharing options...
Stemon63 Posted May 3, 2019 Share Posted May 3, 2019 Lookup field is a TField object where FieldKind = fkLookup? Maybe there is a slowdown problem within the Tdataset, not Unigui related. Have you tried the same dataset in a vcl form? Quote Link to comment Share on other sites More sharing options...
lcolombo Posted May 3, 2019 Author Share Posted May 3, 2019 hi, Yes, Lookup field is a TField object where FieldKind = fkLookup. I did a test in vlc and there are no changes in the time it takes to load the dbgrid (in addition to loading the total of the records and not just 25 as in the paged unidbguid). Regards, Quote Link to comment Share on other sites More sharing options...
lcolombo Posted May 8, 2019 Author Share Posted May 8, 2019 Hi, I found the problem: When I add a lookup field (TField object where FieldKind = fkLookup) or a calculated field (TField object where FieldKind = fkCalculated) to the dataset, OnCalcFields event is executed ( 3 * DataSet.RecordCount) times when opening the table. In vcl, the OnCalcFields event is only executed once for each record shown in the grid. For example, in Unigui, if the table has 93000 records, OnCalcFields event is executed 279000 times when the grid is displayed (even if the grid has paging). In vcl, the event runs 37 times (the number of rows the grid initially shows) and then runs once for each new row that is displayed (for example, when scrolling down). How I tried it: procedure TMainForm.DataTable1CalcFields(DataSet: TDataSet); begin inc(i); UniLabel1.Caption := i.ToString; end; Quote Link to comment Share on other sites More sharing options...
Stemon63 Posted May 9, 2019 Share Posted May 9, 2019 Please report this issue to Farshad! It's important for performances Thanks Quote Link to comment Share on other sites More sharing options...
lcolombo Posted May 10, 2019 Author Share Posted May 10, 2019 Reported ! Regards 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.