When you're defining a geoprocessing task that has feature or table input, one of the Input mode options in the Service Editor is User defined value. When this input mode is chosen, the Schema section displays a list of fields, their aliases, and their types, as shown in the screen capture 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 displays the schema of the output data. As with 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 which fields and field values are required for your task.
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 the Geometry Type.
Removing fields from an input schema
The schema cannot be modified in the Service Editor. You must modify the schema of the input layer or dataset used to create the result you are 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 remove fields by following the steps below.
- In the Service Editor, right-click the task and click Remove.
- In the ArcMap table of contents, right-click the layer or table and choose Properties.
Tip:
If you are modifying a table that is not a layer, click the List By Source button to view all tables in your current ArcMap session.
- Click the Fields tab.
- In the Choose which fields will be visible list, uncheck the fields you want 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 the 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 can delete unwanted fields on the feature class or table (using the Delete Field tool, for example), and 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, modify the schema as described above, run the tool again using the layer or table view as input, and share the new result.
Adding fields
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 result to share.
Field aliases
A field alias is an alternative name for a field that is more descriptive and user-friendly than the name. Clients can use the alias for display and editing purposes. You cannot change the alias in the Service Editor. You must change the alias on the dataset used to create the result you are publishing.
Note:
Only geodatabase datasets support field aliases. Shapefiles and other formats do not support field aliases.
- Exit the Service Editor.
- Browse 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 need to reexecute the 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 Desktop, the geometry type is enforced; you cannot supply features that are of a different geometry type, but different attributes are allowed.
Web clients that are built using ArcGIS API for JavaScript 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 displays the schema of the output.
It is not uncommon for this schema to change, depending on the inputs provided—that is, it is dynamic, not static. 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.
Note:
When your task executes, the schema sent to the client is what is produced by the execution of the task. This schema may be different than what is displayed in the Service Editor.
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; using 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. To modify the task parameter's schema, you must modify the Feature Set or Record Set schema used in your custom tools. See the following links for more information about Feature Set and Record Set:
ArcGIS Desktop clients
There are certain aspects of a schema that are only available to ArcGIS Desktop clients and not to web clients built on the REST APIs, such as those using ArcGIS API for JavaScript.
Coded value domains
Attribute domains are rules that restrict which 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 in a dataset can have a default value that is used when a feature or row is created. To set a default value for a field, complete the following steps:
- Browse 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 a default value.
- In the Field Properties section, enter a default value for the field.
- Click OK.