main logo
Subject: Re: ischanged()
Author: Ed Leafe
Posted: 2001/11/08 16:27:44
 
View Entire Thread
New Search


<i><font color="#663300">Do you remember what the problem was? How was GETNEXTMODIFIED() not working? Was it failing to distinguish between new, unmodified records, since the PK field had been "changed" when the record was created? If so, I could easily add code to check for such conditions that would be a lot simpler and cleaner than the example you quoted.</font></i>

OK, here's the code:

<code>IF CURSORGETPROP("BUFFERING") = DB_BUFOPTTABLE
* See IF there is a modified record anywhere in the cursor.
*** EGL: 11/8/2001 - Modified this so that new, unchanged records will not be marked as "changed"
*!* llIsChanged = (GETNEXTMODIFIED(0) # 0)
lnRecNo = IIF(EOF(), .NULL., RECNO())
lnChangedRec = GETNEXTMODIFIED(0)
DO WHILE lnChangedRec # 0
GO (lnChangedRec)
* If this is a new, unchanged record, the result of GETFLDSTATE() will be all "1"s
IF EMPTY(CHRTRAN(GETFLDSTATE(-1), "1", ""))
* This is a new and unmodified record
This.CleanBuffer()
ELSE
* Aha! There is an actual change to the data!
llIsChanged = .T.
EXIT
ENDIF
ENDDO
* Return to the original record
GO IIF(ISNULL(lnRecNo), RECCOUNT() + 1, lnRecNo)
</code>
[rest of method snipped]

Please test this out and let me know if it works for you.
<font color="#cc0000"> ___/
/
__/
/
____/</font>
Ed Leafe
 
©2001 Ed Leafe
<-- Prior Message New Search Next Message -->