Skip To Content

Filter widget

The Filter widget allows you to limit the visibility of features in one or more layers to only those that meet the expression criteria. Changes made in a Filter widget affect data across your app, so other widgets that use the same layers are filtered accordingly.

Examples

Use this widget to support app design requirements such as the following:

  • You have a large data set and want to provide different audiences with relevant options to filter the data by what matters to them.
  • You want to allow users to change the visibility of features in all the widgets that use the same layer in your app.

Usage notes

The Filter widget requires that a data source be set for each filter that you add. Each filter can be turned on or off by end users to control the visibility of features. When you configure multiple filters for this widget, you can specify whether all enabled filters must be true to show the data or if any can be true to show the data.

Settings

The Filter widget includes the following settings:

  • New filter—Create a filter by selecting a data source and adding expressions. The Create new filter panel that opens includes the following properties:
    • Data—Select the data that you want to filter. You can only select one data source per filter. Feature layers, feature layers in selected web maps, and feature service URLs are supported.
    • Label—Customize the name of each filter.
    • Icon—Choose a different icon and color for each filter.
    • SQL Expressions—Build SQL expressions to specify the filter criteria. The SQL Expression Builder provides several options for creating complex and interactive queries.
    • Options—You can turn on the following options for each filter:
      • Apply this filter automatically—When users open the app, this filter is already applied to the data. Users can turn off the filter in the widget.
      • Collapse filter details (if any) automatically—If the filter is configured to ask for values, users must click to expand the filter to see the additional details. (Turn on this option for a clean look if you have many filters.)
  • When you add multiple filters, click AND to specify that all filter criteria must be true or click OR to specify that any filter criteria can be true.

SQL Expression Builder

A filter uses logical expressions to find and display features in a layer based on attribute values in its data. Expressions use the general form of <Field name> <operator that specifies a condition> <Value or Field>. For example, Shelter capacity is greater than 200.

To create expressions in the SQL Expression Builder, click Add clause or Add clause set.

The expression for each clause includes the following input boxes:

  • Field—Select a field from the data source to filter on. The three field types are number, string, and date. Representative icons appear next to the field names.
  • Operator—Select a functional operator to evaluate the data values for the selected field. Operators vary depending on the field type.
  • Value—Type or select a value to complete the clause. Click the Select a display style for source type button Select a display style for source type to choose a display style based on how you want to choose a value, such as user input, field, unique, and multiple. Styles include options such as text box, drop-down list, date picker, and field selector.

For each clause, you can set the following additional options:

  • Case sensitive—To meet filter criteria, data must match the use of lowercase and uppercase in the clause values. This option is only applicable to string fields in nonhosted layers (the button is disabled for hosted layers).
  • Ask for values—Allow users to provide custom input and change filters at run time. You can customize the label, provide a hint or instruction to users, and choose criteria for the values list that users see in the filter options (the latter is only applicable to unique and multiple source type). You can show all values, filter values based on a previous expression, or filter values based on all the expressions.

If you add more than one clause or clause set to the filter, click AND to specify that all filter criteria must be true or click OR to specify that any filter criteria can be true. You can also configure this setting for the clauses in a clause set.