Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Automatic refresh tables or changes detection
Thu, Dec 4 2008 12:10 PMPermanent Link

=?iso-8859-1?Q?Santy_Concepci=F3n?=
Hi!

Ok, this is a common question of some customers, but I need to know if there
is some method to improve this...

Althoug our app is designed to automatically refresh visible data when
necessary, some customers say that it would be nice and more reliable if the
actual data shown is refreshed automatically in realtime.

I explain:
* Network application. App is executed.
* The app consists on a DBGrid showing records of the same table
* I edit or add a record in computer A
* Computer B is still showing old data until I refresh the table.

I know this is by default, but for those users who complains... Which is the
best method to refresh the visible data when data has changed to ensure the
visible data is updated? Maybe using a threaded Timer which refreshes every
second? Any "changes detector"?

Thanks!

--
Santy Concepción
Thu, Dec 4 2008 3:31 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Santy,

<< I know this is by default, but for those users who complains... Which is
the best method to refresh the visible data when data has changed to ensure
the visible data is updated? Maybe using a threaded Timer which refreshes
every
second? Any "changes detector"? >>

The only way is to use a timer and call the Refresh method for the desired
dataset ever X number of seconds.

--
Tim Young
Elevate Software
www.elevatesoft.com

Sun, Dec 14 2008 11:08 PMPermanent Link

"Ralf Bertoldi"
Tim,

just one question..
What happens exactly when calling "refresh" and the "LastUpdated" of
the table didn't change?

Does the server send all data again?.. Does "refresh" send an request
to the server to resend the data again?

I really don't know...
IMHO there should be a mechanism that compares the "LastUpdated".. and
if it's different the data is sent... am I right?

But what happens to "Lookup" or "calculated" fields...?
Do 'LookUp" fields perform the same way?...

So I'm thinking if it would make sense to first ask the server if the
table or the lookup tables have changed.

Idea would be to store at client side the "Lastupdated" from Lookup
tables.

Then, timer based, ask the server if the tables have changed..

example of procedure with param of tablename(s)..

 if (AnsiCompareText(ProcedureName, 'lastupdate')=0) then
 begin
   tblTemp := TDBIsamTable.Create(nil);
   try
   tblTemp.SessionName := ServerSession.SessionName;
   tblTemp.DatabaseName := MyDatabasePath;
   tblTemp.TableName :=
ServerSession.RemoteParams.ParamByName('table').AsString;
   tblTemp.Open;
   tblTemp.Refresh;
   ServerSession.RemoteParams.Clear;


ServerSession.RemoteParams.CreateParam(ftDateTime,'lastupdate').AsDateTi
me := tblTemp.LastUpdated;
   tblTemp.Close;
   finally
     tblTemp.Free;
   end;

 end


I'm not sure if this would make sense,.. or if it's "overdressed"...

Thanks for suggestions,

Ralf

Mon, Dec 15 2008 10:09 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ralf,

<< What happens exactly when calling "refresh" and the "LastUpdated" of the
table didn't change? >>

The client sends a Refresh request to the server, the server then checks to
see if the data has changed, and refreshes the cursor, if necessary.  Due to
the way that the TDataSet architecture works in Delphi, a refresh will also
cause a resync of the current cursor position and a re-read of all of the
cursor rows needed to satisfy the data-aware controls.

<< But what happens to "Lookup" or "calculated" fields...? >>

They are also refreshed.  Again, this is the TDataSet architecture doing
this.

<< Do 'LookUp" fields perform the same way?... >>

Yes.

<< So I'm thinking if it would make sense to first ask the server if the
table or the lookup tables have changed. >>

Yes, that would be a good way to avoid any issues with the way that the
TDataSet.Refresh works.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image