SetName Method for LCFieldlist
This method changes the name of a field within a fieldlist.
Defined In
LCFieldlist
Syntax
Call fldLstRecord. SetName (index, fieldName)
Parameters
Parameter |
Description |
---|---|
index |
Long, >=1. The index position of the field. |
fieldName |
String. The new name to give to this field. |
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
Call FldLst.SetName (1, "pinky")
text = ""
Forall fieldname In FldLst.Names
If (text = "") Then text = fieldname Else text = text + ", " + fieldname
End Forall
Print "The new list of columns in the '" & connect.Metadata & "' table are: " & text
End If
End Sub
Example Output
The new list of columns in the 'customer' table are:
pinky, CONTACTNAME, COMPANYNAME, COMPANYADDRESS, COMPANYCITY, COMPANYSTATE, COMPANYPHONE