Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread table refresh
Sun, Dec 27 2009 5:20 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Just a question. I was using

procedure TsrCommons.RefreshTablesAndEMDC;
var
Cntr: integer;
begin
if not lu.Config.Active then lu.Config.Open;
for Cntr := 0 to dm.DB.DataSetCount - 1 do begin
 if dm.DB.DataSets[Cntr].Active then dm.DB.DataSets[Cntr].Refresh;
end;
if lu.Config.FindKey(['emDownloadControl']) then iEMDC.AsString := lu.Config_ParamData.AsString;
end;

to make sure I had the latest info and suddenly found my email software had stopped downloading web images. Eventually found that the reason was the table it should have been storing it in was no longer in edit/insert mode. It took a long while to spot because I was looking in totally the wrong place Smiley It wasn't until I enabled full logging and looked through the logfile that I found the culprit.

I've fixed things by altering my code to

procedure TsrCommons.RefreshTablesAndEMDC;
var
Cntr: integer;
begin
if not lu.Config.Active then lu.Config.Open;
for Cntr := 0 to dm.DB.DataSetCount - 1 do begin
 if dm.DB.DataSets[Cntr].Active and (not (dm.DB.DataSets[Cntr].State in dsEditModes)) then dm.DB.DataSets[Cntr].Refresh;
end;
if lu.Config.FindKey(['emDownloadControl']) then iEMDC.AsString := lu.Config_ParamData.AsString;
end;


Long preamble but the question is should table.Refresh leave edit/insert mode alone? If not does it post the data or what?

Roy Lambert
Sun, Dec 27 2009 9:58 AMPermanent Link

"Walter Matte"
I find Refresh has a time hit on tables with large amounts of data.  I use
it only as necessary and would not "refresh" in a generic routine.

Also, when you test State .... shouldn't you test Edit and Insert.   ...If
State in [dsEdit,dsInsert]

Walter

"Roy Lambert" <roy.lambert@skynet.co.uk> wrote in message
news:0528E377-7BA8-451D-A185-26FCAD95DE81@news.elevatesoft.com...
> Just a question. I was using
>
> procedure TsrCommons.RefreshTablesAndEMDC;
> var
> Cntr: integer;
> begin
> if not lu.Config.Active then lu.Config.Open;
> for Cntr := 0 to dm.DB.DataSetCount - 1 do begin
> if dm.DB.DataSets[Cntr].Active then dm.DB.DataSets[Cntr].Refresh;
> end;
> if lu.Config.FindKey(['emDownloadControl']) then iEMDC.AsString :=
> lu.Config_ParamData.AsString;
> end;
>
> to make sure I had the latest info and suddenly found my email software
> had stopped downloading web images. Eventually found that the reason was
> the table it should have been storing it in was no longer in edit/insert
> mode. It took a long while to spot because I was looking in totally the
> wrong place Smiley It wasn't until I enabled full logging and looked through
> the logfile that I found the culprit.
>
> I've fixed things by altering my code to
>
> procedure TsrCommons.RefreshTablesAndEMDC;
> var
> Cntr: integer;
> begin
> if not lu.Config.Active then lu.Config.Open;
> for Cntr := 0 to dm.DB.DataSetCount - 1 do begin
> if dm.DB.DataSets[Cntr].Active and (not (dm.DB.DataSets[Cntr].State in
> dsEditModes)) then dm.DB.DataSets[Cntr].Refresh;
> end;
> if lu.Config.FindKey(['emDownloadControl']) then iEMDC.AsString :=
> lu.Config_ParamData.AsString;
> end;
>
>
> Long preamble but the question is should table.Refresh leave edit/insert
> mode alone? If not does it post the data or what?
>
> Roy Lambert

Sun, Dec 27 2009 1:23 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Walter

>I find Refresh has a time hit on tables with large amounts of data. I use
>it only as necessary and would not "refresh" in a generic routine.

Agreed, but a generic routine still has to be called and I'm reasonably careful where I call it Smiley

>Also, when you test State .... shouldn't you test Edit and Insert. ...If
>State in [dsEdit,dsInsert]

dsEditModes is shorthand for [dsEdit, dsInsert]

Roy Lambert
Mon, Dec 28 2009 9:56 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< Long preamble but the question is should table.Refresh leave edit/insert
mode alone? If not does it post the data or what? >>

Refresh does a CheckBrowseMode, which will force a Post if the dataset is in
dsInsert,dsEdit and has been modified.  This is standard TDataSet code, not
ours.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Dec 28 2009 11:12 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

>Refresh does a CheckBrowseMode, which will force a Post if the dataset is in
>dsInsert,dsEdit and has been modified. This is standard TDataSet code, not
>ours.

I thought this morning that it was probably standard TDataSet (but the D2006 help isn't) and then this afternoon I realised that since I was subclassing TEDBTable anyway I could add my own custom open/refresh method.

Roy Lambert
Image