GETFLDSTATE()

From Recital Documentation Wiki
Revision as of 11:24, 22 August 2011 by Yvonnemilne (Talk | contribs)

Jump to: navigation, search

Purpose

Function to to check if a field has been modified


Syntax

GETFLDSTATE(<expC> | <expN1>, <expN2> [, <workarea | alias>])


See Also

CURSORGETPROP(), CURSORSETPROP(), CURVAL(), OLDVAL(), TABLEREVERT(), TABLEUPDATE(), SETFLDSTATE()


Description

The GETFLDSTATE() function can be used to check if a field has been modified. The field can be specified using the field name in <expC> or the field number in <expN1>. GETFLDSTATE() returns the values below.

If the optional <workarea | alias> is specified, then the function will operate in the required location.

Return value

Value Description
1 Field has not been modified, deleted or recalled.
2 Field has been modified, deleted or recalled.


Example

close databases
clear
set exclusive off
open database southwind
use customers
// Set to known value before start
replace customerid with "ALFKI"
 
cursorsetprop("Buffering", 5, "customers")
messagebox("Buffering set to " +etos(cursorgetprop("Buffering")))
 
? "Original customerid value: " + customerid
? "Curval(): " + curval("customerid")
? "Oldval(): " + oldval("customerid")
? "Fieldstate at start: " + getfldstate("customerid")
 
replace customerid WITH "RECIT"
 
// Alter in another session
! recital -c "update southwind\!customers set customerid = 'MULTI' where recno() = 1"
? "Someone else just updated the record!"
? "New customerid value: " +  customerid 
? "Curval(): " + curval("customerid")
? "Oldval(): " + oldval("customerid")
? "Fieldstate after replace: " + getfldstate("customerid")
tablerevert(.T.)
 
? "Reverted customerid value: " +  customerid
? "Curval(): " + curval("customerid")
? "Oldval(): " + oldval("customerid")
? "Fieldstate after revert: " + getfldstate("customerid")
 
replace customerid WITH "RECIT"
? "New customerid value: " +  customerid 
tableupdate(.T.)
? "Updated customerid value: " +  customerid
? "Curval(): " + curval("customerid")
? "Oldval(): " + oldval("customerid")
? "Fieldstate after replace and update: " + getfldstate("customerid")
?


Products

Recital, Recital Server