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. You can also limit the hosted feature layer view to a specific area by defining a spatial extent. 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 or an area of interest 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 you 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.
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.
You cannot use a field definition to hide certain types of fields. For example, you cannot uncheck system fields that the portal requires such as the layer's ID. You also cannot hide fields that don't allow null values if you have not set a default value for the field. If no default value is set, editors must have access to nonnullable fields to input values when editing.
- To define an extent, click Define an Area of Interest. Type an address or place name into the search box to take you to the general area of interest. You can accept the default envelope around the search location, or you can draw a box or polygon around the area of the layer you want available through the hosted feature layer view. If your view contains more than one sublayer, you can apply the same area of interest to all layers by checking Apply to all layers in this view layer. Click Apply when you finish defining the area.
If you define different areas of interest on each layer in a hosted feature layer view, you cannot enable synchronization.