Page 1 of 1
Update data showed in xBrowse
Posted: Wed Sep 11, 2024 12:31 pm
by vilian
Hi guys,
I have a xBrowse where I show rows of a MySql Table. This module is opened in several computers at the same time and records are being modified.
What is the best way to keep updated the rows that are being shown in this xBrowse?
Re: Update data showed in xBrowse
Posted: Wed Sep 11, 2024 1:08 pm
by karinha
Re: Update data showed in xBrowse
Posted: Wed Sep 11, 2024 1:31 pm
by vilian
Karinha,
No my friend, oBrw:Refresh(.t) doesn't help.
The records are being modified in other computers, so i wanted to know if there is a way to be notified when the records need to be updated in xbrowse, because they were modified in others computers.
Re: Update data showed in xBrowse
Posted: Thu Sep 12, 2024 6:55 am
by Maurizio
I use a refresh button with oBrw:oRs:Requery()
Maurizio
Re: Update data showed in xBrowse
Posted: Thu Sep 12, 2024 10:59 am
by vilian
Than you Maurizio,
Nowaday, I'm doing like you.
Re: Update data showed in xBrowse
Posted: Thu Sep 12, 2024 11:43 am
by Marc Venken
You could refresh the browse by using a timer (to read current data of changed items and if so refresh) so that changes on other computers will change the data on all computers.
Re: Update data showed in xBrowse
Posted: Thu Sep 12, 2024 11:52 am
by vilian
Thank you Marc,
Yes, we're using a timer too. But I think xbrowser could have a method to Sync automatically all records that are been shown.
Look, not all the oRowset's records, just those that are visible right now in the xbrowser
Re: Update data showed in xBrowse
Posted: Thu Sep 12, 2024 12:35 pm
by Marc Venken
Maybe a autosync can be build .... I think from a earlier post from Mr. Rao that Xbrowse only updates the visible rows and not need to read the full rowset.
In that post we where talking about uptimised filters and indexes and Mr. Rao wanted to explain that in full theorie/praktic but due to time/work that item was not covered yet.
You probebli know that speed issues over LAN are gone once using FWH with Remote Desktop.
Re: Update data showed in xBrowse
Posted: Thu Sep 12, 2024 12:38 pm
by vilian
Yes, Something like an autosync would be great!
Re: Update data showed in xBrowse
Posted: Thu Sep 12, 2024 12:43 pm
by Marc Venken
Re: Update data showed in xBrowse
Posted: Thu Sep 12, 2024 12:51 pm
by vilian
Yes,
But, there he is doing autosyng in the same computer and I need it in different computers.
Re: Update data showed in xBrowse
Posted: Thu Sep 12, 2024 1:13 pm
by nageswaragunupudi
No my friend, oBrw:Refresh(.t) doesn't help.
Obviously oBrw:Refresh() can not make oRs to read the records from the Server again.
Requerying frequently makes the application sluggish.
There is a less known method
This method refreshes only those records which are updated by other users on the network after the RowSet is updated last.
But this works only if the table contains a column that records "modified datetime"
Though it is very easy to create that kind of column using our library, I am sure most of users might not have created such column.
This method reads the current record only from the server and updates.
Returns if the record is changed by other users.
Code: Select all | Expand
oRowSet:NetChanged( [RecNo], [@lDeleted] ) // -->lChanged
Code: Select all | Expand
oBrw:bChange := { || If( oRs:NetChanged(), oBrw:RefreshCurrent(), nil ) }
When we are navigating the browse, this will update the row from the server. Not all visible rows but the current row.
Re: Update data showed in xBrowse
Posted: Thu Sep 12, 2024 2:07 pm
by vilian
Thank you Mr Rao, your advices are always great!
oRowSet:Resync() // --? lChanged
Here, oRowSet:Resync() is always returning .T., even the record was not changed.
Do you think is possible to do an option to verify all visible record in the xBrowse and update only those that were changed?
Nowaday, I'm doing it by this way:
Code: Select all | Expand
LOCAL lTem:=.F.,nPos:=0,nRegAt := ::oTab:Recno()
DEFAULT bBloco := {|| .T.}
::oTmr:DeActivate()
::oTab:Skip(::oLbx:nRowSel * (-1))
DO WHILE nPos < ::oLbx:nDataRows .AND. .NOT. ::oTab:Eof()
IF Eval(bBloco)
lTem := .T.
::oTab:ReSync()
ENDIF
nPos++
::oTab:Skip()
ENDDO ::oTab:GoTo(nRegAt)
IF lTem
::oLbx:Refresh()
ENDIF
::oTmr:Activate()
But i believe it could be done better
Re: Update data showed in xBrowse
Posted: Thu Sep 12, 2024 2:25 pm
by vilian
I'm using Eval(bBloco) because I have some status where a record can't be modified anymore, so if he is in this status, i don´t need resync it.