While you might be able to "guess" most of the time, I'm sure it wouldn't be absolutely reliable.
Code:
IF RECNO() = RECCOUNT() && it's probably an Insert
* Note: This could also be true in an
* APPEND BLANK, REPLACE situation
*
ELSE && it's probably a Replace / Update SET
*
ENDIF
I have made several post's regarding the issue and i really have a hard time explaing the problem but i will try again.
Table test has a logical field lsend (default .t.) and an autoincrementing field nid. The table has a validation rule of setsend() in a db stored procedure.
Code:
FUNCTION setsend()
* Don't do it if lSend is getting replaced
IF TYPE("lsend") = "L"
IF CURVAL("lSend") = lsend
replace lSend WITH .T.
ENDIF
ENDIF
ENDFUNC
With data buffering enabled i am getting a data type mismatch error whenever i issue an insert statement. The only way around this is to use append blank followed by a replace. There is some type of a conflict that is happening between the autoincrement field and the rule.
My final thought was if an insert statment was being issued then ignore the rule as the field lsend is defaulted to .t..
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.