CasewareDocs

AppendField

Adds a field to the database.

Compatibility

Available as of IDEA version 10.0

Syntax

AppendField(fieldName As String, description As String, fieldType As Integer, length As Integer, decimals As Integer, [optional] equation As String)

Parameter

fieldName

Name of the new field. Cannot be nothing.

description

Description of the new field.

fieldType

Type of the new field. The following enumeration describes the possible values:

public enum VBFieldType

{

WI_VIRT_CHAR = 0,

WI_VIRT_NUM = 1,

WI_VIRT_DATE = 2,

WI_CHAR_FIELD = 3,

WI_NUM_FIELD = 4,

WI_DATE_FIELD = 5,

WI_EDIT_NUM = 6,

WI_EDIT_CHAR = 7,

WI_EDIT_DATE = 8,

WI_MULTISTATE = 9,

WI_TRISTATE = 9,

WI_BOOL = 10,

WI_TIME_FIELD = 11,

WI_EDIT_TIME = 12,

WI_VIRT_TIME = 13

}

length

Length of the new field.

decimals

In case of a numeric field, specifies the number of decimals positions.

equation

Equation of the new field. This parameter is optional.

Examples

Using database name:

Sub Main()

Dim oMC As Object
Dim oFM As Object
Set oMC = SmartContext.MacroCommands

Set oFM = oMC.FieldManagement("AAA.IMD")
oFM. AppendField "NUM_FIELD", "NUM_FIELD_DESCR", _
1, 8, 2, "2*A" 'type 1: virtual numeric
oFM. AppendField "CHAR_FIELD", "CHAR_FIELD_DESCR", _
0, 32, 0, "C+D" 'type 0: virtual char
oFM.PerformTask
Set oFM = Nothing

End Sub

Using reference of currently open database:

Sub Main()

Dim db As Object
Dim oMC As Object
Dim oFM As Object
Set db = Client.OpenDatabase("AAA.IMD")
Set oMC = SmartContext.MacroCommands
Set oFM = oMC.FieldManagement(db)
oFM. AppendField "NUM_FIELD", "NUM_FIELD_DESCR", _
1, 8, 2, "2*A" 'type 1: virtual numeric
oFM. AppendField "CHAR_FIELD", "CHAR_FIELD_DESCR", _
0, 32, 0, "C+D" 'type 0: virtual char
oFM.PerformTask
Set oFM = Nothing
Client.CloseAll

End Sub