Update data showed in xBrowse

Update data showed in xBrowse

Postby vilian » Wed Sep 11, 2024 12:31 pm

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?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 982
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Update data showed in xBrowse

Postby karinha » Wed Sep 11, 2024 1:08 pm

Code: Select all  Expand view  RUN

   oBrw:Refresh(.T.) ??
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Update data showed in xBrowse

Postby vilian » Wed Sep 11, 2024 1:31 pm

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.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 982
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Update data showed in xBrowse

Postby Maurizio » Thu Sep 12, 2024 6:55 am

I use a refresh button with oBrw:oRs:Requery()

Maurizio
User avatar
Maurizio
 
Posts: 826
Joined: Mon Oct 10, 2005 1:29 pm

Re: Update data showed in xBrowse

Postby vilian » Thu Sep 12, 2024 10:59 am

Than you Maurizio,

Nowaday, I'm doing like you.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 982
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Update data showed in xBrowse

Postby Marc Venken » Thu Sep 12, 2024 11:43 am

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.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Update data showed in xBrowse

Postby vilian » Thu Sep 12, 2024 11:52 am

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
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 982
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Update data showed in xBrowse

Postby Marc Venken » Thu Sep 12, 2024 12:35 pm

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.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Update data showed in xBrowse

Postby vilian » Thu Sep 12, 2024 12:38 pm

Yes, Something like an autosync would be great!
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 982
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Update data showed in xBrowse

Postby Marc Venken » Thu Sep 12, 2024 12:43 pm

Something to look into ??

viewtopic.php?f=3&t=36383
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Update data showed in xBrowse

Postby vilian » Thu Sep 12, 2024 12:51 pm

Yes,

But, there he is doing autosyng in the same computer and I need it in different computers.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 982
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Update data showed in xBrowse

Postby nageswaragunupudi » Thu Sep 12, 2024 1:13 pm

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
Code: Select all  Expand view  RUN
oRowSet:Refresh()

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.

Code: Select all  Expand view  RUN
oRowSet:Resync() // --? lChanged

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 view  RUN
oRowSet:NetChanged( [RecNo], [@lDeleted] ) // -->lChanged


Code: Select all  Expand view  RUN
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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Update data showed in xBrowse

Postby vilian » Thu Sep 12, 2024 2:07 pm

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 view  RUN
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 :(
Last edited by vilian on Thu Sep 12, 2024 4:46 pm, edited 1 time in total.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 982
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Update data showed in xBrowse

Postby vilian » Thu Sep 12, 2024 2:25 pm

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.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 982
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 70 guests