Group Filter widget

The Group Filter widget allows you to apply a filter on the map based on one or more layers in the map. A set of layers are grouped into a logical filter set. Each set can have a predefined value to facilitate user interaction. This widget has two modes: normal, which allows the building of complex filters during run time, and simple, which only allows one filter to be applied.

Configure the Group Filter widget

This widget can be set to open automatically when an app starts. Click the Do not open this widget when the app starts button Do not open this widget when the app starts on the widget to turn on the option to open the widget automatically. (For widgets you need to add to the app first, you can make this setting after configuring the widget.)

The following steps indicate how to create a filter set. Repeat these steps if you need to define additional filter sets.

  1. Hover over the widget and click the Configure this widget button Configure this widget to open the configuration window.
    Note:

    If you need to add the widget to the app first, click a widget placeholder on the Widget tab. In the Choose Widget window that opens, select the widget and click OK.

  2. Optionally click Change widget icon to replace the default icon for this widget.
    A file explorer window appears, allowing you to choose a local image file to use as the widget icon.

    The configuration displays one group that's ready to modify.

  3. Define a Filter Set Name.

    The filter set name option, will be the name that a user will select from. Optionally, you can give a description to guide users on what this group will filter.

  4. Optionally use Preset Operator and Preset Value to define a value for this filter so that during run time, users do not have to supply these criteria. For Preset Value, you have the option to type a value or click the search button to choose a value from an existing layer.
  5. If you want to filter on different fields in the same layer, the When a layer is listed more than once, use the following operator between fields parameter controls how to join these filters using OR or AND.
  6. The table that is provided, display the layers to group together under the filter set. You should see one layer already populated by default with a random layer from your map. Choose the layer and the field to which you want to apply a filter.
  7. Select the Use Value button, this allows you to choose whether a value drop-down list appears for the user to find a value. If the option is not selected, a plain text box appears instead.

    Note:

    This button is optional.

  8. To add another layer to this filter set, click the Add Layer button.
  9. To add another filter set, click the Add a New Group button. This creates another filter set grouping. If needed, repeat steps 3 through 7.
  10. Specify the custom header text using the Provide text to display above filter selection text box.
  11. The following five check boxes control the way the widget behaves:
    • Start in Simple View determines how the widget will appear to end users. Checking this box will remove the operator drop-down list and the Add Criteria button from the interface, giving it a more basic appearance.
    • Hide Widget Options determines whether to show an icon to expose additional widget settings. These settings include saving and loading defined filters, appending to an existing filter definition in the map if it exists, and persisting the filter even after the widget is closed.
    • If the web map has an existing predefined filter applied, Append Filter to Existing Web Map Filter Using OR or And allows you to decide if you want to override this filter or append filters created in this widget to the existing web map filter. By default, this widget will override the web map filter. Additionally, enabling this will persist filters across multiple groups.
    • Zoom to determines whether to zoom the map to the extent of the filtered data. By default, the map maintains its current extent.
    • Persist After Widget is Closed allows you to persist the filter when the widget is closed.
    • Hide the header and filter selection if only 1 group is configured allows you to hide the header and drop-down menu when only one group is configured.

Use the Group Filter widget

  1. Click the Group Filter widget to display a selection of predefined filter sets.

    Apply a predefined filter set

    Two lists appear below the line divider: operators and values. In the example, the map is filtered to show only abandoned motor vehicle complaints.

    Note:

    Depending on how the layers are configured in the widget, you will either see a values list (similar to the one in this example), a text box for user input, or a date picker.

  2. Click Apply to apply the filter to the map.

    Optionally, you can apply filters by adding URL parameters to the app's URL. The URL must be in the following format—replace the variables in angle brackets with the values described in the list below:

    https://<your portal URL>/apps/webappviewer/index.html?id=<Item ID>&groupfilter={"<Filter Set Name>":["<value>","<value>",...]}
    • Item ID—The unique ID of the app.
    • Filter Set Name—The defined name for the filter group. This value is case sensitive.
    • Value—The value used to perform the filter. To filter based on domains, use the domain code.

    For example, to apply the filter shown in the preceding image, you'd use a URL similar to the following sample:

    https://<your portal URL>/apps/webappviewer/index.html?id=6815e148ff1c4aee8dc7159816380a4d&groupfilter={"Group A":["Abandoned Motor Vehicle"]}

    Note:

    If the Group Filter widget isn't configured to open automatically when the app starts, the filter defined in the URL won't apply until you open the widget.

  3. Click Reset to remove the filter and restore the map to its initial state. (By default, closing the widget will also remove the filter.)
  4. The widget allows you to add additional filter criteria at run time. Click Add Criteria to add another clause. Notice that the two criteria are joined with a conjunction. You can choose to join them using OR or AND.

    Add additional filter criteria

    To use URL parameters to apply the filter shown in this example, your URL would look like the following sample:

    https://<your portal URL>/apps/webappviewer/index.html?id=6815e148ff1c4aee8dc7159816380a4d&groupfilter={"Group A":["Abandoned Motor Vehicle","Auto Theft"]}

  5. The widget has a save option to save these defined criteria settings for future use. Click the settings button to access the options panel.

    Save option

    1. Click Save to save the defined criteria locally as a JSON text file.
    2. Click Upload a Saved File to load a previously saved file to restore all the criteria defined in the file.
    3. If you need to use the filtered map in other widgets, check Persist After Widget is Closed. Otherwise, closing the widget will remove filters and restore the map's initial state.