Table of Contents
VField Class: Properties
VField.CollationAttribute
Declaration:
CollationAttribute( inColAttribute as EVColAttribute ) as EVColAttributeValue
Description:
The value of the specified collation attribute for this table.
Example:
V = fld.CollationAttribute( EVColAttribute.kStrength ) fld.CollationAttribute( EVColAttribute.kStrength ) = EVColAttributeValue.kPrimary
VField.DefaultValue
Declaration:
DefaultValue asVariant
Description:
The default value of a field. This value is used when you INSERT a new record into the table, but do not specify a value for this field. By default this property is nil.
Example:
v = fld.DefaultValue
VField.ID
Declaration:
ID as Integer (r/o)
Description:
Return the unique identifier of the field.
Example:
id = fld.ID
VField.IndexStyle
Declaration:
IndexStyle as VIndexStyle
Description:
Specifies the index style for this field. You can use this property to assign/change the index style of a field. Also, you can check the current index style of the field.
Example:
fld.IndexStyle = style1 currStyle = fld.IndexStyle
VField.IsEncrypted
Declaration:
IsEncrypted as Boolean (r/o)
Description:
Returns TRUE if the database is encrypted.
Example:
encrypted = fld.IsEncrypted
VField.IsIndexed
Declaration:
IsIndexed as Boolean
Description:
If TRUE then Valentina will maintain an index for this field. This property can be changed at runtime.
Example:
fld.IsIndexed = FALSE ... // add many records for example fld.Indexed = TRUE
VField.IsMethod
Declaration:
IsMethod as Boolean (r/o)
Description:
TRUE if the field is virtual, i.e. it is a Table Method. Read Only.
Example:
if( fld.IsMethod )
VField.IsNullable
Declaration:
IsNullable as Boolean
Description:
If TRUE then this field can have a NULL value. In this case, 1 bit per record is added.
Example:
fld.IsNullable = TRUE if( fld.Nullable ) ...
VField.IsNull
Declaration:
IsNull as Boolean
Description:
This is a record property. It is TRUE if the value of this field for the current record of the table is NULL.
NOTE: don’t confuse it with the property of isNullable! isNullable is a property of the column of a table, IsNull is a property of the current record.
Example:
.... curs.Position = i if( curs.Field(1).IsNull ) then ....
VField.IsUnique
Declaration:
IsUnique as Boolean
Description:
If TRUE then this field will not accept duplicate entries. Also, if the field is unique then it is automatically indexed.
Example:
fld.IsUnique = TRUE if( fld.Unique ) ...
VField.LocaleName
Declaration:
LocaleName as String
Description:
Specifies the locale name for this field.
Example:
LocaleName = fld.LocaleName fld.LocaleName = "en_US" fld.LocaleName = "jp_JP"
VField.MethodText
Declaration:
MethodText as String
Description:
Returns the text of the field method. Also, you can use this property to change the text of the field method.
Example:
method = fld.MethodText
fld.MethodText = "CONCAT(FirstName, ‘ ‘, LastName)"
VField.Name
Declaration:
Name as String
Description:
Each field has a unique name in the scope of a Table. The maximum length of the name is 32 bytes.
Example:
name = fld.Name
fld.Name = "last"
VField.OriginalFieldID
[NEW in 7.3.1]
Declaration:
OriginalFieldID as UInt32
Description:
This method is intended for use with VCursor's fields.
Returns the ID of original field, that was used for this field of the cursor. Using this ID you can get an original field and therefore its name, etc.
If cursor field is the result of the expression (e.g. “f1 + f2”), i.e. we cannot get its original field, then this method returns 0.
Example:
fldID = fld.OriginalFieldID fld = tbl.FieldByID( fldID )
See Also:
VField.OriginalTableID
[NEW in 7.3.1]
Declaration:
OriginalTableID as UInt32
Description:
This method is intended for use with VCursor's fields.
Returns the ID of original Table, that was used for this field of the cursor. Using this ID you can get an original table.
If cursor field is the result of the expression (e.g. “f1 + f2”), i.e. we cannot get its original table, then this method returns 0.
Example:
TableID = fld.OriginalTableID tbl = db.TableByID( TableID )
VField.StorageEncoding
Declaration:
StorageEncoding as String
Description:
Specifies for this table the encoding of strings stored on disk.
Example:
Encoding = fld.StorageEncoding
fld.StorageEncoding = "UTF-16"
VField.Table
Declaration:
Table as VTable (r/o)
Description:
Returns the Table of this field.
Example:
t = fld.Table
VField.Type
Declaration:
Type as EVFieldType (r/o)
Description:
Each field has a type, which defines the context of data which can be stored in it. The type of a field is defined when you use a constructor of a subclass of VField.
Each field has several flags, which define its behavior:
Example:
case fld.Type
VField.TypeString
Declaration:
TypeString as String (r/o)
Description:
Returns the type of this field as a string. This can be used in GUI tools.
Example:
strType = fld.TypeString
VField.Value
Declaration:
Value as Variant
Description:
The VField class has a property Value of the general kind called a VARINAT. This means that you can easily get/set the value of any field type using this property.
Also, note that each subclass of VField class has its own property Value of the corresponding type. When REALbasic and Valentina know the exact type of value they work faster. So if you care about speed you should prefer to use the Value of subclasses.
Example:
dim f as VField dim iv as integer f.value = 5 iv = f.value