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 mode, which allows building complex filters during runtime, and simple mode, which only allows one filter criteria to be applied.
Configuring the Group Filter widget
The Group Filter widget can be set to open automatically when an app starts. To do so, click the yellow dot on the widget to turn it dark green.
The following steps indicate how to create a filter set. Repeat these steps if you need to define additional filter sets.
- Hover over the widget and click the small edit icon . The configuration window for this widget opens.
- Optionally click change widget icon if you want to replace the default icon for this widget. A file explorer window opens, allowing you to choose a local image file to use as the widget icon.
- The configuration should display one group that's ready to modify.
- Define a Filter Set Name. This is the name of the filter that the user will select from. Optionally, you can give a description to guide users on what this group will filter.
- Preset Operator and Preset Value are both optional. They allow you to have a predefined value for this filter so that during runtime, the user does not have to supply the criteria. For Preset Value, you have the option to type in a value or click the magnifying glass icon to choose a value from an existing layer.
- If you are going to filter on different fields in the same layer, the next optional parameter When a layer is listed more than once, use the following operator between fields controls how to join these filters together using OR or AND.
- The next area is a table of layers to group together under this filter set. By default, you should see one layer already populated with a random layer from your map. Choose the layer and the field to which you want to apply a filter. The radio button under the column Use Value dictates whether or not you want a value drop-down list for the user to find a value. If no radio button is marked, a plain text box will be presented to the user. This radio button is optional.
- To add another layer to this filter set, click the Add Layer button.
- If you want to add another filter set, click the Add a New Group button. This will create another filter set grouping. If needed, repeat step 3 through 7.
- The next four check boxes control the way the widget behaves.
- Start in Simple View determines how the widget will look to end users. Checking this box will remove the operator drop-down list and the add criteria button from the interface. This will make the interface look more simplistic.
- 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.
- Zoom to determines whether to zoom the map to the extent of the filtered data. By default, the map maintains its current extent.
Using the Group Filter widget
- Clicking the Group Filter widget in your app displays a selection of predefined filter sets. Notice below the gray line divider, you see an operator and a drop-down list. This is interpreted, for example, as filter the map and show only Abandoned Motor Vehicle complaints. Click Apply to execute filtering the map.
- Clicking Reset will remove the filter and restore the map to the state prior to using the widget.
- The widget allows you to add additional filter criteria at runtime. Click the Add Criteria button to add another clause. Notice that the two criteria are joined with a conjunction. You can choose to join them using either OR or AND.
- The widget has a save option to save these defined criteria settings for future use. Click the gear icon. The widget panel will switch to the options panel.
- Clicking Save will save the defined criteria locally as a JSON text file.
- Under Upload a Saved File, you can load a previously saved file to load back all the criteria defined in the file.
- If you need to use the filtered map in other widgets, you can enable it here to persist the filter after this widget is closed. By default, closing the widget will revert all filters to the map's initial state.