The esri_fielddef_set function sets the field definition for an attribute field of a document feature layer. You cannot update an existing field's field TYPE or modify a web feature layer field definition.
Syntax
(esri_fielddef_set flname field_properties)
Arguments
- flname | string | required | An existing feature layer name in the drawing.
- field_properties| associated list | required | An associated list of feature layer field properties as dotted pairs as follows:
Associated label Value type Value description Required or optional "NAME" string
The field name.
Required
"LENGTH" integer
The field length for text fields only.
Optional (set to UI defaults)
"VALUE" variant
The default field value.
Optional (set to UI defaults)
"SUBTYPE" string
An existing feature layer subtype name in the drawing. When setting the field definition of a sublayer, only set the default value.
Optional
Example usage
Attempt to update the definition of the Location field of the Parks feature layer.(esri_fielddef_set "Parks"
(list
(cons "NAME" "Location")
(cons "LENGTH" 254)
(cons "VALUE" "CA")
))
Result example usage
Updates the definition of the Location field of the Parks feature layer, and returns a list of true:
(T)Return values
The following are the possible return values:
- If successful, the function returns a list of true: (T).
- If failed, it returns a list with the first value of nil; then, an associated list is returned containing the key value "Error" and an associated error message as a string: (nil ( "Error" . "<message>")).
Failed return values
Failed return values can occur for any of the following reasons:
- (nil ("Error" . "Field is not editable"))
You cannot update an existing field's field type or modify a web feature layer field definition.
- (nil ("Error" . "Input string was not in a correct format."))
The specified value was of the wrong type.
- (nil ("Error" . "Document feature layer not found."))
The specified feature layer value is not a valid feature layer in the drawing.
- (nil ("Error" . "No edits made"))
No edits were made because there was a problem with the routine as written.