====== Read_Row routine ======
==== Description ====
Returns one or more rows from a table.
==== Syntax ====
**Read_Row**(//tablename//, //keylist//, //lockflag//, //readonlyflag//)
==== Parameters ====
The Read_Row routine has the following parameter.
^Parameter^Description^
|//tablename//|The name of the table that contains the row to read.|
|//keylist//|A key or list of keys to read from //tablename//. The list should be an @fm-delimited list.|
|//lockflag//|Specifies whether or not the row is locked during the read operation. If null, no locking takes place. If a row is locked, it remains locked after the procedure is completed.\\ \\ __Lockflag__ - __Description__\\ 0 - No locking takes place.\\ 1 - Row is locked prior to read and remains locked.|
|//readonlyflag//|Specifies whether or not this row is read-only (not be updated). If true (1), the read request may be fulfilled from any cache or buffers maintained by the system. Otherwise, the row must be read from disk.|
==== Returns ====
Returns the rows specified in //keylist//. If a single key is passed to the routine the results will be placed into the @RECORD system variable, as well as the [[receiver|SYSTEM RECEIVER]]. If multiple keys are passed to the routine, a [[receiver|SYSTEM RECEIVER]] must be implemented and the data will be returned to the RECEIVER. Data returned to the RECEIVER will contain tab-delimited field values and carriage return/line feed separated records.
==== See Also ====
[[lock|Lock]], [[unlock|UnLock]], [[write_row|Write_Row]], [[receiver|RECEIVER property]]
==== Examples ====
=== Example Using System Monitor ===
* This command reads the customer records "1" and "2".
* This command is meant to be run form the SYSTEM MONITOR
run Read_Row "CUSTOMERS", [1, 2]
=== Example Using RECEIVER ===
* This will return the contents of keys 1 and 2 from the Customers table.
* Capture text results of Read_Row in the edit box EDITBOX_RESULTS.
Declare Function Get_Property
Declare Subroutine Set_Property, Read_Row
Set_Property ("SYSTEM", "RECEIVER", @window: ".EDITBOX_RESULTS")
Set_Property (@window: ".EDITBOX_RESULTS", "TEXT", "")
Read_Row("CUSTOMERS",1 : @fm : 2, "", "")
recordData = Get_Property (@window: ".EDITBOX_RESULTS", "TEXT")
swap TAB$ with @fm in recordData
swap CRLF$ with @rm in recordData
* reset the receiver property to null.
Set_Property ("SYSTEM", "RECEIVER", "")