Difference between revisions of "CURVAL()"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
Function to  
+
Function to return field values directly from disk
  
  
 
==Syntax==
 
==Syntax==
CURVAL()
+
CURVAL(<expC> [, <workarea | alias>])
  
  
Line 12: Line 12:
  
 
==Description==
 
==Description==
 +
The CURVAL() function can be used to return one or more field values directly from disk.  During buffered processing, this allows checks to be made for changes to the data, since the record was accessed.  The field or fields to be checked are specified in <expC>.
  
 +
If the optional <workarea | alias> is specified, then the function will operate in the required location. 
  
  
 
==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>
  

Latest revision as of 12:29, 22 August 2011

Purpose

Function to return field values directly from disk


Syntax

CURVAL(<expC> [, <workarea | alias>])


See Also

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


Description

The CURVAL() function can be used to return one or more field values directly from disk. During buffered processing, this allows checks to be made for changes to the data, since the record was accessed. The field or fields to be checked are specified in <expC>.

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


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