Difference between revisions of "GETFLDSTATE()"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
|||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Function to to check if a field has been modified | Function to to check if a field has been modified | ||
− | |||
==Syntax== | ==Syntax== | ||
GETFLDSTATE(<expC> | <expN1>, <expN2> [, <workarea | alias>]) | GETFLDSTATE(<expC> | <expN1>, <expN2> [, <workarea | alias>]) | ||
− | |||
==See Also== | ==See Also== | ||
[[CURSORGETPROP()]], [[CURSORSETPROP()]], [[CURVAL()]], [[OLDVAL()]], [[TABLEREVERT()]], [[TABLEUPDATE()]], [[SETFLDSTATE()]] | [[CURSORGETPROP()]], [[CURSORSETPROP()]], [[CURVAL()]], [[OLDVAL()]], [[TABLEREVERT()]], [[TABLEUPDATE()]], [[SETFLDSTATE()]] | ||
− | |||
==Description== | ==Description== | ||
Line 17: | Line 14: | ||
====Return value==== | ====Return value==== | ||
− | {| class="wikitable" | + | {| class="wikitable" width="100%" |
!Value||Description | !Value||Description | ||
|- | |- | ||
Line 25: | Line 22: | ||
|- | |- | ||
|} | |} | ||
− | |||
− | |||
==Example== | ==Example== | ||
Line 46: | Line 41: | ||
? "Fieldstate at start: " + getfldstate("customerid") | ? "Fieldstate at start: " + getfldstate("customerid") | ||
− | replace customerid WITH " | + | replace customerid WITH "LIANJ" |
// Alter in another session | // Alter in another session | ||
− | + | // update southwind!customers set customerid = 'MULTI' where recno() = 1 | |
? "Someone else just updated the record!" | ? "Someone else just updated the record!" | ||
? "New customerid value: " + customerid | ? "New customerid value: " + customerid | ||
Line 62: | Line 57: | ||
? "Fieldstate after revert: " + getfldstate("customerid") | ? "Fieldstate after revert: " + getfldstate("customerid") | ||
− | replace customerid WITH " | + | replace customerid WITH "LIANJ" |
? "New customerid value: " + customerid | ? "New customerid value: " + customerid | ||
tableupdate(.T.) | tableupdate(.T.) | ||
Line 72: | Line 67: | ||
</code> | </code> | ||
− | |||
− | |||
− | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
− | [[Category: | + | [[Category:Cursor Functions]] |
− | + |
Latest revision as of 13:38, 19 May 2014
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 |
2 | Field has been modified |
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 "LIANJ" // Alter in another session // 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 "LIANJ" ? "New customerid value: " + customerid tableupdate(.T.) ? "Updated customerid value: " + customerid ? "Curval(): " + curval("customerid") ? "Oldval(): " + oldval("customerid") ? "Fieldstate after replace and update: " + getfldstate("customerid") ?