FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour oDbf:modified() no regresa a .F. después de guardar el reg.
Posts: 107
Joined: Tue Sep 15, 2009 07:52 AM
oDbf:modified() no regresa a .F. después de guardar el reg.
Posted: Thu Jun 20, 2013 06:03 PM

Tengo problemas con el uso de oDbf:modified()

¿Es posible que odbf:Modified() (ni oDbf:Updated() en su caso) no pase a .F. aún después de realizar oDbf:save() seguido de su correspondiente oDbf:Commit()?

Saludos

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: oDbf:modified() no regresa a .F. después de guardar el reg.
Posted: Fri Jun 21, 2013 06:02 AM

Thanks for pointing this out.
Method Save() should have called ::Load().
We shall fix this in next version.

For now, please use this workaround:
After calling oDbf:Save(), please call oDbf:Load()

Regards



G. N. Rao.

Hyderabad, India
Posts: 107
Joined: Tue Sep 15, 2009 07:52 AM
Re: oDbf:modified() no regresa a .F. después de guardar el reg.
Posted: Fri Jun 21, 2013 05:26 PM

Then I should wait until your next release. It is impossible for me to do it that way since I have my own Scatter and Gather beside (and above) those provided by Odbf and it will be a nightmare to reload data and gather in my 230 variables anew (has to do with Dbase field limitations and I was forced to use memo fields to subdivide them in several ones for the problem at hand like in the good all days in assembler). :shock:

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: oDbf:modified() no regresa a .F. después de guardar el reg.
Posted: Fri Jun 21, 2013 05:44 PM

I suppose you are using FWH13.05
For scatter/gather FWH provides two alternatives.

  1. You can use Tdatabase class.
  2. If you continue using DBF directly, you can use TDataRow class.

TDatabase class:
For the problem you pointed out in this post we have two alternatives.
(a) Call oDbf:Load() after calling oDbf:Save()
OR
(b) Make this modification in database.prg and link with your project.
Please go to line no 1049 in method Save()
Between "endif" in line 1049 and next "endif" in line 1050 insert a line
::Load()

TDataRow() class.

You may use normal DBFs
Instead of legacy scatter/gather functions

oRec := TDataRow():New( <cAlias> )

You can refer to fields of the DBF like
? oRec:<fieldname>
oRec:<fieldname> := NewVaue
You can also create dialogs with @ r,c GET oRec:Amount PICTURE ....

When finished you can all'
oRec:Save()
This will save the modified data in the same record.

Example:
USE CUSTOMER NEW SHARED ALIAS CUST
SKIP 10
oRec := TDataRow():New( "CUST" )
? oRec:Age
oRec:Age := 50
? oRec:Modified()
oRec:Save()

There is also a default simple edit dialog
oRec:Edit()

Regards



G. N. Rao.

Hyderabad, India
Posts: 107
Joined: Tue Sep 15, 2009 07:52 AM
Re: oDbf:modified() no regresa a .F. después de guardar el reg.
Posted: Fri Jun 21, 2013 06:29 PM

Thanks for your prompt and extensive response. I suppose you mean between lines 1046 and 1047 (2 consecutive ENDIFs of method save() class Tdatabase)

Will try.

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: oDbf:modified() no regresa a .F. después de guardar el reg.
Posted: Fri Jun 21, 2013 06:32 PM

yes

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion