To control what data users see, the owner of a hosted feature layer view, or an administrator, can define what fields or features are available in the view. These definitions are saved with the hosted feature layer view and allow you more control over what content people see.
For example, you might create multiple different views of a hosted feature layer containing customer information, and set different definitions for each view depending on the intended users. For a view you share with a group that will perform spatial analysis, you might hide the fields that store customer names, as the analysts don't need to know this information. For another view that you share with a group concerned with routing deliveries, you would define the view to show only features representing customers who purchased a product that had not yet been delivered.
You can set and save view definitions from the Visualization tab of a hosted feature layer view's details page or add the layer or view to Map Viewer and set the definition in the Contents pane.
Be aware of the following when setting a definition for a hosted feature layer view:
- You should only use field or feature definitions if your organization is configured to allow only standardized SQL queries. Check with the administrator of your organization to confirm that the organization has Allow only standard SQL queries enabled.
- You cannot set a field or feature definition on a hosted feature layer view if it has a dependent hosted tile layer.
- Certain configurations are defined on individual fields. If you hide a field used to configure such things as symbology, labels, pop-ups, relationships, and time settings, those configurations no longer function in the hosted feature layer view.
- When users other than the owner or administrator export from a hosted feature layer view that has definitions applied, the exported file will contain only those fields or features that the definition allows. When the owner or administrator exports, the definitions are not applied, and the exported file contains all fields and features.
The following steps describe how to set a definition for a hosted feature layer view from the view's details page:
- Open the hosted feature layer view's details.
- If you are the view's owner, open the details page from the My Content tab of the content page.
- If you are an administrator, either use Search to find the view, or access the view from the My Organization's Content tab of the content page.
- Click the Visualization tab.
- Under the item, click the More Options button and click Set View Definition.
- Choose the type of definition to set.
- To restrict what features are available based on field values, click Define Features, choose a field, and define the expression that will return the features you want to make available in the view. You can apply multiple feature definitions for the same view. When you are done, click Apply Definition.
- To define which fields are available in the view, click Define Fields and uncheck any fields you don't want people to access. Click OK when you finish defining available fields.
Some fields cannot be hidden using a field definition. For example, you cannot uncheck system fields that the portal requires such as the layer's ID. You also cannot hide nonnullable fields that do not have a default value set, as editors need access to the fields to input values when editing.