Difference between revisions of "OLDVAL()"
From Recital Documentation Wiki
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
Line 17: | Line 17: | ||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
+ | 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") | ||
+ | ? | ||
</code> | </code> | ||
Revision as of 11:00, 22 August 2011
Purpose
Function to
Syntax
OLDVAL()
See Also
CURSORGETPROP(), CURSORSETPROP(), CURVAL(), GETFLDSTATE(), TABLEREVERT(), TABLEUPDATE(), SETFLDSTATE()
Description
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