Description
This tool deletes one or more fields from a table. If more than one field is specified, but one of the fields does not exist, the tool will continue to attempt to delete the other fields. An asterisk (*) can be used at the start and/or end of the field name as a wildcard, but it cannot be used in the middle of the field name. Also, the asterisk wildcard is only recognized when a single string is provided to the 'fld' parameter, but not in an array of string. For example, these are all valid uses of an asterisk: fld=AR*, or fld=*SIZE, or fld=*AA*. These are NOT valid uses of an asterisk: fld=A*BC, or fld=*A*B*, or fld=c(AREA, PERIM*).
Using wildcards to delete fields can be dangerous! Take great care in how the wildcard text is specified. There is no undo, so the delete is permanent. As a precaution this tool will never delete a geometry field or any of the special unique ID fields (thus the FID field is protected, but typically the ID field is not as it is commonly just an integer field).
Syntax
field.delete(in, field);
| in | the input feature data source | |
| fld | the names of the field(s) to delete (use the c() format to specify more than one field - see example below) |
Example
field.delete(in="C:\data\referencelayer.shp", field="MYFLD1");
field.delete(in="C:\data\roads.shp", field=c("NAME", "PROV", "SURFACE"));
field.delete(in="C:\data\roads.shp", field="LEN*");