Ask AI

How to filter list data from the URL?

Navigate your users to a filtered version of the list

This is a handy feature if you want your users to be taken to a filtered version of your List via URL. You can filter the list through an Inline Filter or Search. Let’s consider the Inline Filter case first.

Filtering the list through an inline filter

To filter the list by one of the Inline Filter values, you need to use the following format: ?filter-by-fieldName=fieldValue

💡
In order for the URL filter to work, you need to have an Inline Filter set up for the same field in your list.

You should add the filtering parameters at the end of your List URL, replacing fieldName with the name of the field you want to use for filtering and fieldValue with the value you want to filter by. Let's consider a specific example to make it clear.

Example

Let's say we have a list of employee profiles with a Position field and want to have a URL that filters the list, leaving only the profiles where the Position is Engineer.

List of employee profiles
List of employee profiles

First of all, let's set up a corresponding Inline Filter.

Adding an inline filter
Adding an inline filter

Next, let's configure the URL, which will look as follows:

  • https://<subdomain>.softr.app/list?filter-by-Position=Engineer
💡
Note that both fieldName and fieldValue are case sensitive. For instance, in the current example, the field name should be "Position" and not "position" or "POSITION."

That's it. Now, let's check if everything is working correctly.

Testing the filtering

💡
If you have a space inside your field name or value, you can replace it with "%20" inside the URL.

Filtering the list through search

To pre-filter the list through search, you need to use the following format: ?search-for=searchValue

💡
In order for the URL parameter to work, you need to have a search bar set up for your list with Search by field(s) selected.

You should add the parameter at the end of your List URL, replacing searchValue with the query you want to filter the list by. Let's consider a specific example to make it clear.

Example

Let’s say we have a list of tasks for a software development team, where each task has a name.

A list of tasks
A list of tasks

So, if we add the following parameter at the end of our page URL, we will see a list that only contains entries with a value “merge”: ?search-for=merge

Testing the URL
Testing the URL

Combining search and inline filters

It’s also possible to combine inline filter and search parameter formats by simply joining them with an “&”: ?filter-by-fieldName=fieldValue&search-for=searchValue

As a result, only the list records that match both of the conditions will be displayed.

Did this answer your question?
😞
😐
🤩

Last updated on March 21, 2024