Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread How to Refresh Table Record X Only
Sat, Jun 1 2024 4:45 PMPermanent Link

Andrew Hill

I have a Table in ReadOnly Mode shown in a Grid - All Good.

When Record X is selected in Grid and Edit is Requested I use a separate form with editors and the results are then saved by a TQuery to update Record X on disk - All Good.

To notify my Grid that Record X has changed I usually do a Table/Datasource Refresh then a Grid Current Row Refresh - All Good BUT SLOW DUE TO ALL RECORDS BEING FETCHED AGAIN

Is there a way to request a Table Record X Refresh Only ?
Sun, Jun 2 2024 6:24 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Andrew


Simple answer - NO

Complex answer - depends on the grid you're using and how much work you want to put in, and if the whole table is capable of being held in memory

Better answer: <<SLOW DUE TO ALL RECORDS BEING FETCHED AGAIN>> - why is this slow? What happens to the speed if the table is not read only? Is it F/S or C/S? Are there loads of calculated / computed columns in the table? If a query are all the right indices in place?

Roy Lambert
Mon, Jun 3 2024 2:14 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Andrew


Another thought occured - alter the table to not be in read only mode and use standard table editing boxes rather than nonDB editors

Roy Lambert
Mon, Jun 3 2024 4:48 PMPermanent Link

Andrew Hill

Roy, Thanks for your response.

This is a web project and I have the grid working just the way I want.

I tried:-

tblPurchases.Resync(rmExact);

and would like to get this to work but there is an issue with ResyncMode and ResyncModeItem ?
Wed, Jun 5 2024 5:15 PMPermanent Link

Andrew Hill

Tim can you please comment
Wed, Jun 19 2024 3:29 PMPermanent Link

Andrew Hill

Tim can you please advise how ?
Wed, Jun 19 2024 6:36 PMPermanent Link

Terry Swiers

> Tim can you please advise how ?

You will want to contact him directly as he isn't in the support forums very often.

Every DB aware grid that I've worked with will refresh all of the visible rows when the underlying dataset is modified.  So, even if you can get EDB to refresh the individual row, you are going to have to prevent the grid from retrieving the rest of the records after the dataset is updated.

If the live data table isn't too big or constantly changing, load the data into a local in-memory dataset such as a TFDMemTable and use that for the grid data source.  After the edit is posted, query the live table to pull back just the modified record, and then update the corresponding TFDMemTable record.  With the data local, it doesn't matter if the grid refreshes the rest of the records because it doesn't have to hit the database again.
Thu, Jun 20 2024 2:35 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Terry


If its just the visible rows I wouldn't expect it to be overly slow. Unfortunately, Andrew hasn't given any quantifiable information. Your suggestion is along the same lines as mine but much more elegantly phrased.

Resync isn't one of Tim's functions but goes back to Delphi and, without investigating, I suspect, as you seem to, that its the grid that is asking for the refreshing.

Andrew: what DBGrid are you using? If its the standard one you'd need to subclass and modify but a lot of the advanced grids already have the capability to load the entire dataset (basically it is a stringgrid)

Roy Lambert
Sat, Jun 22 2024 5:51 PMPermanent Link

Andrew Hill

Thanks Terry and Roy for your comments.

My grid is a JavaScript Grid (Sencha) and works perfectly doing everything I want including offering the option of RefreshCurrentRow etc.

There are times when a particular event requires that I change data in the background across many tables using SQL and when the current grid row is affected I need to refresh it, it is very easy to do a Table Refresh BUT I only want the current underlying table ROW to be refreshed.

Off memory some offerings catered for Table Row Refresh in the past.
 
Image