Promotic
WikipediaLinkedInYoutubeTwitterFacebook

FieldValues - property of object PmDatabase

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 by the vField parameter).
Syntax:
FieldValues([vField As Variant]) As Variant
Calling:
x = oDb.FieldValues(vField)
Parameters:
vField[optional] (Variant) Column name of the table or its index (zero-based index). If this parameter is missing, then the property reads the whole row of the table/writes into the whole row of the table 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 it is possible to define 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:
Dim x
' reading from the column with the name "column1" and the first row of the table
If oDb.IsOpen Then
  oDb.MoveFirst
  x = oDb.FieldValues("column1")
  Pm.Debug x
' reading from the first column and the second row of the table
  oDb.MoveNext
  x = oDb.FieldValues(0)
  Pm.Debug x
' writing into the third column and the second row of the table
  x = 100
  oDb.FieldValues(2) = x
  Pm.Debug x
End If
Example2:
Writing into more columns in the first 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.
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 first row of the table by the Array of values.
Dim arr
If oDb.IsOpen Then
  arr = Array(1,12,"Note")
  oDb.MoveFirst
  oDb.FieldValues = arr
End If
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice