main logo
Subject: ischanged()
Author: graeme thomson
Posted: 2001/11/07 19:28:37
 
View Entire Thread
New Search


sorry, I can't remember the contributor but some time back there were some issues disussed in the Ischanged() method of cbizobj.
there were some problems with :

IF CURSORGETPROP("BUFFERING") = DB_BUFOPTTABLE
* See IF there is a modified record anywhere in the cursor.
llIsChanged = (GETNEXTMODIFIED(0) # 0)

we changed this to the following and it solved the problems:
IF CURSORGETPROP("BUFFERING") = DB_BUFOPTTABLE
* See IF there is a modified record anywhere in the cursor.
*----------------------------------------------------------
*- 9/11/2000 JAE GETNEXTMODIFIED not working consistenty
*- Implemented scan instead

*- llIsChanged = (GETNEXTMODIFIED(0) # 0)

lnRecords = THIS.GetRecCount()
IF lnRecords = 0
RETURN .F.
ELSE
STORE .F. TO llBOF, llEOF, llIsChanged
DO CASE
CASE BOF()
llBOF = .T.
CASE EOF()
llEOF = .T.
OTHERWISE
lnRecno = RECNO()
ENDCASE

SET DELETED OFF

SCAN
lcFldState = GETFLDSTATE(-1)
IF '2' $ lcFldState OR '4' $ lcFldState
llIsChanged = .T.
EXIT
ENDIF
ENDSCAN

SET DELETED ON

DO CASE
CASE llBOF
GO TOP
IF !BOF()
SKIP -1
ENDIF
CASE llEOF
GO BOTTOM
IF !EOF()
SKIP
ENDIF
OTHERWISE
GO lnRecno
ENDCASE
ENDIF
*---------------------------------------------------------------
ELSE

my question indirectly relates to this method:
In a form I have, I am adding new records to a child using oform.obizobj.New()
The records add fine and edit ok. really no problem HOWEVER
the above method was generating an error. After days of searching I discovered that as each record was added, if you check the RECNO() it is a negative: -1,-2,-3 etc as the records are added. The ischanged() method then bombs out at Go lnRecno because a negative record does not exist.
I have no idea whether this negative value is normal or I have done something incorrect somewhere or is this really an obscure bug.

(I corrected the problem by inserting
IF lnRecno<=0
lnRecno = 1
ENDIF)


 
©2001 graeme thomson
<-- Prior Message New Search Next Message -->