Jump to content

UniDBGrid with lookup fields


Recommended Posts

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 ?


Link to comment
Share on other sites


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).




Link to comment
Share on other sites

I found the problem:

When I add a lookup field (TField object where FieldKind = fkLookup) or a calculated field (TField object where FieldKind = fkCalculatedto 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);
    UniLabel1.Caption := i.ToString;


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...