Remove Method for LCFieldlist

This method removes an existing field from a fieldlist. This does not remove a column from associated metadata. See the earlier section entitled "Fieldlist Merging and Mapping" for related information about how removing or adding columns to a result set affects Fetch, Insert and other operational methods.

Defined In

LCFieldlist

Syntax

Call fldLstRecord .Remove (index)

Parameters

Parameter

Description

index

Long, >= 1. The index position of the field to be removed from the fieldlist.

Example

Option Public
Uselsx "*lsxlc" 
Sub Initialize
  Dim connect As New LCConnection ("db2") 
  Dim FldLst As New LCFieldlist
  Dim field As LCField
  Dim text As String
  REM this section assigns the appropriate properties to connect to DB2
  connect.Database = "Gold"
  connect.Userid = "JDoe"
  connect.Password = "xyzzy"
  connect.Metadata = "customer"
  REM connect to DB2
  connect.Connect
  REM now perform the catalog action - in this case for fields
  If (connect.Select (Nothing, 1, FldLst) = 0) Then
    Print "The customer table was not found."
  Else
    REM fetch the field names
    Forall fieldname In FldLst.Names
      If (text = "") Then text = fieldname Else text = text + ", " + fieldname
    End Forall
    Print "Before remove: " & text
    Call FldLst.Remove (1)
    text = ""
    Forall fieldname In FldLst.Names
      If (text = "") Then text = fieldname Else text = text + ", " + fieldname
    End Forall
    Print "After remove: " & text
  End If
End Sub

Example Output

Before remove: ACCOUNTMANAGER, CONTACTNAME, COMPANYNAME, COMPANYADDRESS, COMPANYCITY, COMPANYSTATE, COMPANYPHONE
After remove: CONTACTNAME, COMPANYNAME, COMPANYADDRESS, COMPANYCITY, COMPANYSTATE, COMPANYPHONE