Forum > General

BufDataSet speed

(1/1)

HappyLarry:
In order to perform calculations on the fields of a Bufdataset I need to access each record in the dataset. I 'scroll' through the dataset with

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---      Self.First;      While not Self.EOF do      begin        Self.next;      end;It seems quite slow (e.g. 2 secs for 10000 records or 14 secs for 30000 records) - perhaps this is about right?

Am I doing this in the best way or is there a better way?

marcov:
Is the set wired to some grid? Best is to do such things on datasets that are not bound to GUI controls.

HappyLarry:
Thanks marcov - it makes a huge difference - it now loads in millisecs which is good.

However, once I have 'wired' the dataset to datasource1 with
   Datasource1.dataset := T;
in order to show iit, I can't see how to 'unwire' it in order to scroll and then wire it again to show the results.

Neither
    Datasource1.dataset.cancel
nor
    Datasource1.enabled:=false;
nor
   Datasourse1.destroy
'unwires it'.

This may be obvious, but how can I temporarily unwire Datasource1 from my dataset?

ttomas:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---   Self.DisableControls;   try      Self.First;      While not Self.EOF do      begin        Self.next;      end;   finally      Self.EnableControls;   end; 

Navigation

[0] Message Index

Go to full version