Subclass Xbrowse or changed data function

Subclass Xbrowse or changed data function

Postby Marc Venken » Thu Sep 08, 2022 8:47 am

Using Xbrowse a lot, i'm thinking of the best way to register changes made in the xbrowse data.

A dbf with many fields is updated during the day and this for several fields. The changed data will be uploaded once a day true a API connection.

What do you do in this situation ?

I'm thinking of folowing

Make a changlog dbf where the changed data fields will be put in, and after API update clear this dbf

Name, olddata, newdata
adress, olddata, newdata
etc....

I can have Xbrowse do this for each field with the onchange , but then I have to code each field for this

My question : Can we subclass xbrowse for this to do automatic ? I never want a changed personel xbrowse for my projects because I want to keep all updates.
Maybe with a extra data: oBrw:logchanges -> Is true then log some fields
I never made a class, changed it or did any subclassing.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Subclass Xbrowse or changed data function

Postby nageswaragunupudi » Thu Sep 08, 2022 7:24 pm

Only one line of code
Code: Select all  Expand view
oBrw:bOnChanges := <|oCol, uOldValue|
         FWLOG oCol:oBrw:BookMark, oCol:cExpr, uOldValue, oCol:Value
         return nil
         >
 

Instead of FWLOG, you can use your own write function
Regards

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

Re: Subclass Xbrowse or changed data function

Postby Otto » Thu Sep 08, 2022 9:50 pm

Dear Mr. Rao,
Isn't that a little unsafe?

The data is changed first, and then the old ones are backed up.
What happens if an error occurs?
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: Subclass Xbrowse or changed data function

Postby nageswaragunupudi » Fri Sep 09, 2022 1:55 am

If an error occurs while saving data to the DBF, bOnChange also is not executed.
Regards

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

Re: Subclass Xbrowse or changed data function

Postby Otto » Fri Sep 09, 2022 5:33 am

Dear Mr. Rao,
Therefore, I thought Mark should first save the old data before saving the new.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: Subclass Xbrowse or changed data function

Postby nageswaragunupudi » Fri Sep 09, 2022 1:58 pm

There is nothing special he has to do.
Just keep using XBrowse as it is.
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 73 guests