FieldValues - property of the PmaDatabase object
Description:
The property represents the value of the current row (defined for example by calling the
Move method) and the column of the table (defined in the
vField parameter).
This property is obsolete, it is not functional in
JavaScript language and therefore it is recommended to replace it by calling methods:
ReadFieldValue /
WriteFieldValue.
Syntax:
Variant FieldValues([Variant vField])
Parameters:
vField | [optional] (Variant) Column name of the table or its index (zero-based index).
If not set, then the property reads the whole table row / writes into the whole table row the variable of the Array type. |
---|
Note:
Property access
for read and write.
If an 'empty value' (
<Null>) is read from the table by this property 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.
Example1:
JavaScriptVBScriptSelect and copy to clipboard
var x;
var oDb = pMe.Pm("/Database0");
if (oDb.IsOpen())
{
// reading from the column named "column1" and the 1st table row
oDb.MoveFirst();
x = oDb.FieldValues("column1");
Pm.Debug(x);
// reading from the 1st column and the 2nd table row
oDb.MoveNext();
x = oDb.FieldValues(0);
Pm.Debug(x);
// writing into the 3rd column and the 2nd table row
x = 100;
oDb.FieldValues(2) = x;
Pm.Debug(x);
}
Dim x, oDb
Set oDb = pMe.Pm("/Database0")
If oDb.IsOpen() Then
' reading from the column named "column1" and the 1st table row
oDb.MoveFirst
x = oDb.FieldValues("column1")
Pm.Debug(x)
' reading from the 1st column and the 2nd table row
oDb.MoveNext
x = oDb.FieldValues(0)
Pm.Debug(x)
' writing into the 3rd column and the 2nd table row
x = 100
oDb.FieldValues(2) = x
Pm.Debug x
End If
Example2:
Writing into more columns in the 1st row of the table by the
Edit method. In this case it is the better way than to set the
FieldValues property repeatedly without the
Edit.
JavaScriptVBScriptSelect and copy to clipboard
if (oDb.IsOpen())
{
oDb.MoveFirst();
oDb.Edit();
oDb.FieldValues(0) = 1;
oDb.FieldValues(1) = 12;
oDb.FieldValues(2) = "Text";
oDb.Update();
}
If oDb.IsOpen() Then
oDb.MoveFirst
oDb.Edit
oDb.FieldValues(0) = 1
oDb.FieldValues(1) = 12
oDb.FieldValues(2) = "Text"
oDb.Update
End If
Example3:
Writing into more columns in the 1st row of the table by the Array of values.
JavaScriptVBScriptSelect and copy to clipboard
if (oDb.IsOpen())
{
var aVals = Pm.Array1(1, 12, "Note");
oDb.MoveFirst();
oDb.FieldValues = aVals;
}
If oDb.IsOpen() Then
Dim aVals
aVals = Pm.Array1(1, 12, "Note")
oDb.MoveFirst
oDb.FieldValues = aVals
End If