このメソッドは、既存のフィールドをフィールドリストに追加します。
LCFieldlist
Call fldLstRecord. IncludeField (index, field, fieldName)
パラメータ |
説明 |
---|---|
index |
Long、1 ~ (fldLst.FieldCount + 1) の値。フィールドを挿入する fldLstRecord 内の位置です。他のフィールドを上書きせずに、リストの途中にフィールドを挿入できます。 |
field |
LCField。新しいフィールドです。 |
fieldName |
String 型。新しいフィールドの名前です。 |
Option Public
Option Explicit
Uselsx "*lsxlc"
Sub Initialize
Dim fldLstRecord As New LCFieldList
Dim ref As LCField
Dim text As String
' There are a number of ways to build a fieldlist
' Append will add a field to a list given a type
Set ref = FldLstRecord.Append ("ACCOUNTMANAGER", LCTYPE_INT)
Set ref = FldLstRecord.Append ("COMPANYID", LCTYPE_INT)
' Insert is like Append but the position
' within the fieldlist must be specified
Set ref = FldLstRecord.Insert (1, "COMPANYADDRESS", LCTYPE_TEXT)
' CopyField will add a field to a list
' using an existing field as a template
Set ref = FldLstRecord.CopyField (1, fld, "CONTACTNAME")
' IncludeField will add an existing field to a list,
' making it part of the list. in this case, 'fld'
' becomes a reference into the fieldlist
Dim fld As New LCField (LCTYPE_TEXT)
fld.Flags = LCFIELDF_KEY
fld.Flags = 0
Call FldLstRecord.IncludeField (3, fld, "COMPANYCITY")
text = ""
Forall fieldname In FldLstRecord.Names
If Text = "" Then text = fieldname Else text = text + ", " + fieldname
End Forall
Print "The field list looks like: " & text
End Sub
The field list looks like:
CONTACTNAME, COMPANYADDRESS, COMPANYCITY, ACCOUNTMANAGER, COMPANYID