Number of filtered items

Hi @Cichy,

There are two ways you could do this:
1- you could add the filter at collection level in the “Data” menu so that the length of array on the page would include only the filtered data. In that case, you would need to add a workflow action to refetch the collection on the page whenever a user filters data

2- you could get the length of your filtered array with a filterByKey formula wrapped inside a length formula like we did in the example below

In the example below, we filter an array of “jobs” that have “part-time” as the value in the “type” column:

As you can see, there is only 1 result on the page but the “jobs” array length is still 11 because we are applying the filter on the page, not at collection level int he data menu.

So in our filter, instead of binding to the length of the “jobs” array:

We need to bind to the length of the filtered “jobs” array based on the “type” key:

What the highlighted part of the formula is saying is:

  • send me back the length,
  • of the array of “jobs” that match the condition
  • in the column “type”, the value is “part-time”

If you hover over the filterByKey formula in the editor (or any other formula for that matter), you can see how it works: