FieldInfo
Resumen
Provides field info methods and properties for layer and table views.
Sintaxis
Propiedades
| Propiedad | Explicación | Tipo de datos |
| count (Sólo lectura) |
The field count. | Integer |
Vista general del método
| Método | Explicación |
| addField (field_name, new_field_name, visible, split_rule) |
Adds a field info entry |
| exportToString () |
Exports the object to its string representation. |
| findFieldByName (field_name) |
Finds the field index by field name |
| findFieldByNewName (field_name) |
Finds the field index by new field name. |
| getFieldName (index) |
Gets the field name from the table by index position. |
| getNewName (index) |
Gets the new field name from the table by index position. |
| getSplitRule (index) |
Gets the split rule from the table by index position. |
| getVisible (index) |
Gets the visible flag from the table by index position. |
| loadFromString (string) |
Restore the object using its string representation. The exportToString method can be used to create a string representation. |
| removeField (index) |
Removes the field info entry from a table. |
| setFieldName (index, field_name) |
Sets the field name into the table. |
| setNewName (index, new_field_name) |
Sets the new field name into the table. |
| setSplitRule (index, rule) |
Sets the split rule into the table. |
| setVisible (index, visible) |
Set the visible flag of a field on the table. |
Métodos
| Parámetro | Explicación | Tipo de datos |
field_name |
The field name from the input feature class or table. | String |
new_field_name |
Sets the field name for the new layer or table view. | String |
visible |
Sets whether the field is visible or hidden.
| String |
split_rule |
Sets the behavior of an attribute's values when a feature is split.
| String |
| Tipo de datos | Explicación |
| String |
The string representation of the object. |
| Parámetro | Explicación | Tipo de datos |
field_name |
The field name used to find its index position | String |
| Tipo de datos | Explicación |
| Integer |
The index position |
| Parámetro | Explicación | Tipo de datos |
field_name |
The new field name used to find its index position. | String |
| Tipo de datos | Explicación |
| Integer |
The index position. |
| Parámetro | Explicación | Tipo de datos |
index |
The index position. | Integer |
| Tipo de datos | Explicación |
| String |
The field name. |
| Parámetro | Explicación | Tipo de datos |
index |
The index position. | Integer |
| Tipo de datos | Explicación |
| String |
The new field name. |
| Parámetro | Explicación | Tipo de datos |
index |
The index position. | String |
| Tipo de datos | Explicación |
| String |
The split rule.
|
| Parámetro | Explicación | Tipo de datos |
index |
The index position. | String |
| Tipo de datos | Explicación |
| String |
The visible flag.
|
| Parámetro | Explicación | Tipo de datos |
string |
The string representation of the object. | String |
| Parámetro | Explicación | Tipo de datos |
index |
The index position of the field info object. | Integer |
| Parámetro | Explicación | Tipo de datos |
index |
The index position. | Integer |
field_name |
The field name to set into the table. | String |
| Parámetro | Explicación | Tipo de datos |
index |
The index position. | None |
new_field_name |
The new field name to set into the table. | String |
| Parámetro | Explicación | Tipo de datos |
index |
The index position. | Integer |
rule |
The split rule to set into the table.
| String |
| Parámetro | Explicación | Tipo de datos |
index |
The index position. | Integer |
visible |
The visible policy to set into the table.
| String |
Ejemplo de código
Display FieldInfo properties for a feature layer.
import arcpy
fc = "C:/Data/wells.shp"
layer = "temp_layer"
arcpy.MakeFeatureLayer_management(fc, layer)
# Create a describe object
#
desc = arcpy.Describe(layer)
# If a feature layer, continue
#
if desc.dataType == "FeatureLayer":
# Create a fieldinfo object
#
fieldInfo = desc.fieldInfo
index = 0
# Use the count property to iterate through all the fields
#
while index < fieldInfo.count:
# Print fieldinfo properties to the screen
#
print "Field Name: " + fieldInfo.getFieldName(index)
print "\tNew Name: " + fieldInfo.getNewName(index)
print "\tSplit Rule: " + fieldInfo.getSplitRule(index)
print "\tVisible: " + fieldInfo.getVisible(index)
index += 1