When defining a geoprocessing task that has feature or table input, one of the Input modes you can choose in the Service Editor is User defined value. When this input mode is chosen, the Schema section displays a list of fields, their alias, and their types, as illustrated below. This list of fields is the same as the layer or table you used as input to the tool that created the result.
In addition, if the output of your task is a feature class or layer, or a table, the Service Editor will display the schema of the output data. Like input features and tables, the schema for the output comes from the output created by the tool.
Clients use the published schema when constructing features or rows to send to your task. You should remove the extraneous fields and provide documentation so that clients understand what fields and field values are required for your task.
For the purposes of discussion, the Geometry Type of feature input is considered part of the schema because the Shape field is always included with feature input and its Field Type always matches Geometry Type.
Removing fields from an input schema
The schema cannot be modified in the Service Editor. You have to modify the schema of the input layer or dataset used to create the result you're publishing, or use a different layer or dataset to create a new result.
If you used a feature layer or table view from the ArcMap table of contents as the parameter input, you can easily remove fields following the steps below.
- Remove the task from Service Editor. Right-click the task and click Remove.
- In the ArcMap table of contents, right-click the layer or table and choose Properties.
- Click the Fields tab.
- In the Choose which fields will be visible list, uncheck the fields you wish to remove from the schema.
- Click OK.
- In the Service Editor, click Add Result to add the result you removed in step 1. When the Service Editor adds your result, it will read the schema from the layer you just modified.
If you used the path to feature class or table on disk as the tool parameter input (instead of the name of a layer or table view in the table of contents), you could delete unwanted fields on the feature class or table (using the Delete Field tool, for example) then proceed with sharing the result again. You may want to make a copy of the dataset before deleting its fields. A better way is to create a feature layer of the feature class, or a table view of the table, by adding it to ArcMap, modifying the schema as described above, then rerun the tool using the layer or table view as input, and share the new result.
Adding fields
If you need to add fields to your schema, you must exit the Service Editor, add the new field to the dataset (using the Add Field tool, for example), and create a new result to share.
Field aliases
A field alias is an alternative name for a field that is more descriptive and user-friendly than the actual name. Clients can use the alias for display and editing purposes. You cannot change the alias in the Service Editor. You have to change the alias on the dataset used to create the result you're publishing.
- Exit the Service Editor.
- Navigate to the dataset in the Catalog window.
- Right-click the dataset and choose Properties.
- Click the Fields tab.
- Select the field for which you want to provide an alias.
- In the Field Properties section, enter an alias for the field.
- Repeat for other fields for which you want to provide an alias.
- Click OK.
- In the Results window, right-click your result and select Share As > Geoprocessing Service. You do not have to reexecute your tool.
How input schemas are used by clients
The schema provides the default geometry type, spatial reference, and attributes to be used by client applications. When using a task in ArcGIS for Desktop, the geometry type is enforced—you cannot supply features that are of a different geometry type, but different attributes are allowed.
Web clients built with the JavaScript, SilverLight, and Flex APIs can supply your task with partially defined feature sets. If the feature set they supply is missing the geometry type, spatial reference, or fields, they will be filled in using the values defined by the published schema. If the client supplies a fully defined feature set, it will be used as is.
Document what your task requires
If your task requires adherence to schema, you need to document your requirements for your clients. For example, if your task only works with point features, or a particular field is required, or specific field values are expected, document these requirements.
Learn more about documenting geoprocessing services and tasks
Output schemas
When the output of your task is a feature class, feature layer, table, or table view, the Service Editor will display the schema of the output.
It's not uncommon that this schema might change depending on what inputs are provided—that is, it is dynamic (can change) versus static (never changes). For example, the Generate Near Table tool will optionally add the fields NEAR_X, NEAR_Y, and NEAR_ANGLE to the output features based on the values of its Location and Angle parameters. The task you are publishing may be similar to the Generate Near Table tool in that the output schema may vary depending on other parameter values set by the client. Other tools (and tasks created from these tools) may output different geometry types (point, line, or polygon) depending on other parameter values set by the client.
Input schemas based on Feature and Record Sets
Custom model and script tools you create can use the Feature Set or the Record Set data type for input parameters. Using a Feature Set allows you to interactively digitize features in ArcMap, and a Record Set allows you to interactively add rows to a table. Feature Set and Record Set data types have their own schema, which is used to define the task parameter's schema. In order to modify the task parameter's schema, you need to modify the Feature Set or Record Set schema used in your custom tools. See the links below for more information on Feature Set and Record Set.
ArcGIS for Desktop clients
There are certain aspects of a schema that are only available to ArcGIS for Desktop clients and not to web clients built with the JavaScript, SilverLight, or Flex APIs.
Coded value domains
Attribute domains are rules that restrict what values are valid or permissible for the attribute field. If an attribute field in the schema source dataset has a coded value attribute domain, those coded values will be displayed in a drop-down list for that attribute field's value in the feature set or record set control.
Learn more about using the feature and record set controls in ArcMap
Symbology
A feature schema stores symbology information that can be accessed by ArcMap and used when digitizing features with the Feature Set control.
Default value
A field on a dataset can have a default value that is used when a new feature or row is created. To set a default value for a field:
- Navigate to the dataset in the Catalog window.
- Right-click the dataset and choose Properties.
- Click the Fields tab.
- Select the field for which you want to provide default value.
- In the Field Properties section, enter a default value for the field.
- Click OK.