ReadFieldValue - method of the PmaDatabase object
Description:
Method returns the value of column (defined in the
vField parameter) of the current row (defined for example by calling the
Move method) or a complete row in the form of array of values.
Syntax:
Variant ReadFieldValue(Variant vField)
Parameters:
vField | (Variant) Name or index (zero-based index) of table column.
If is -3 then reads the whole table row as Array of values. |
---|
Return values:
Returns a value or
Array of values.
If an error occures, then the method returns:
null for
JavaScript or
Empty pro
VBScript (it can be tested by the
Pm.IsValid method).
Note:
If an 'empty value' (
<Null>) is read from the table by this method then it can be defined by the
SetNullValue method the alternate value that will be returned instead of this empty value. The alternate value is valid up to the next calling the
SetNullValue method.
Example:
JavaScriptVBScriptSelect and copy to clipboard
var x;
var oDb = pMe.Pm("/Database0");
if (oDb.IsOpen())
{
// reading from the column named "column1" and the first row of the table
oDb.MoveFirst();
x = oDb.ReadFieldValue("column1");
Pm.Debug(x);
// reading from the 1st column and the 2nd row of the table
oDb.MoveNext();
x = oDb.ReadFieldValue(0);
Pm.Debug(x);
// reading the whole 2nd row of the table
x = oDb.ReadFieldValue(-3);
Pm.Debug(x);
}
Dim x, oDb
Set oDb = pMe.Pm("/Database0")
If oDb.IsOpen() Then
' reading from the column named "column1" and the first row of the table
oDb.MoveFirst
x = oDb.ReadFieldValue("column1")
Pm.Debug x
' reading from the 1st column and the 2nd row of the table
oDb.MoveNext
x = oDb.ReadFieldValue(0)
Pm.Debug x
' reading the whole 2nd row of the table
x = oDb.ReadFieldValue(-3)
Pm.Debug x
End If