How to Give Users the Power to Define Their Own Queries

29th April 2016

If you’re a regular user of ArcGIS Online, you’ve probably made at least one application using the fantastic Web AppBuilder – if you haven’t, it’s worth a look! You can easily create a feature rich application without writing a single line of code.

One feature available in Web AppBuilder is to allow users to query the data and pull results from it using the Query widget. Whilst this is a popular and easy to use widget, it does require the administrator of the app to predefine queries that they think end user may want to perform. This can be a big ask, especially if the app contains lots of data – the list of possible queries could be endless!

To check out the Query widget in action, check out this Web AppBuilder app:

1. Click the Query widget icon: 

2. Choose one of the predefined queries

3. Enter some text and click Apply to run the query

4. Results are returned in a list (if you click on a result, the map will pan to it):

5. All results are also displayed on the map:

Today we’re going to look at an alternative workflow that allows end users to perform their own queries on the data.

1. In your Web AppBuilder application, add the Attribute Table widget

2. Open it in the application viewer:

** Your view may differ depending on the theme you apply.

3. Click Options > Filter:

4. Here is where end users can apply their own queries or filters to the data:

5. Users can also export the queried/filtered data to a CSV:

The only disadvantage of using this method, is the filter only applies to the attribute table and results are not reflected on the map – but this is something to take into consideration when scoping out what functionality is required for your end users.

You can have a go at this functionality in this app:

Happy app-ing!