# How to filter out data which is coming from data model?

**URL:** https://forum.builder.io/t/how-to-filter-out-data-which-is-coming-from-data-model/15798
**Category:** General
**Tags:** cms
**Created:** [September 25, 2025, 6:36am UTC](https://forum.builder.io/t/how-to-filter-out-data-which-is-coming-from-data-model/15798 "2025-09-25T06:36:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Dhanashree](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@Dhanashree](https://forum.builder.io/u/Dhanashree)
#### Post date: [September 25, 2025, 6:36am UTC](https://forum.builder.io/t/how-to-filter-out-data-which-is-coming-from-data-model/15798/1 "2025-09-25T06:36:55Z")

</div>

_Hiiii,_  
I have created page for Testimonials. There are certain categories like A,B,C etc.  
When I click on the A Testimonial with category p should display. like wise other.  
How to achieve this?  
I try the Query option in the data model but its not filtering the data.  
There is any another option to filtering data?  
Thanks !

---

<div class="post-metadata">

### Author: ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)
#### Post date: [September 26, 2025, 1:00pm UTC](https://forum.builder.io/t/how-to-filter-out-data-which-is-coming-from-data-model/15798/2 "2025-09-26T13:00:34Z")

</div>

Hello @Dhanashree,

To filter testimonials by categories in [Builder.io](http://Builder.io), you’ll want to make use of [data models](https://www.builder.io/c/docs/models-data) effectively. Here’s a step-by-step approach:

### 1. Set Up Your Data Model

- Create a **Testimonials** data model in Builder.
- Add a **category field** (e.g., “A”, “B”, “C”).

Tip: Use a [custom field](https://www.builder.io/c/docs/custom-fields) of type **Select** with predefined options for categories.

### 2. Query Testimonials by Category

Use Builder’s Content API to fetch testimonials filtered by category. For example, with Next.js:

```javascript
import { builder } from '@builder.io/sdk';

builder.init('YOUR_API_KEY');

export async function getTestimonialsByCategory(category) {
  return await builder.getAll('testimonials', {
    query: {
      'data.category': category,
    },
    prerender: false,
  });
}

```

### 3. Connect Category Selection to Queries

When a user clicks a category (A, B, or C), capture that choice via **URL params** or **state management** and pass it to the query.

```javascript
export default function Testimonials({ category }) {
  const [testimonials, setTestimonials] = React.useState([]);

  React.useEffect(() => {
    getTestimonialsByCategory(category).then(setTestimonials);
  }, [category]);

  return (
    <div>
      {testimonials.map((t) => (
        <div key={t.id}>
          <h3>{t.data.title}</h3>
          <p>{t.data.content}</p>
        </div>
      ))}
    </div>
  );
}

```

For more details, see the guide on [integrating structured data](https://www.builder.io/c/docs/integrate-cms-data).

If this doesn’t resolve the issue, please share a screen recording and the content setup in Builder, and we’ll be happy to help further.

Thanks!

---

<div class="post-metadata">

### Author: ![Dhanashree](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@Dhanashree](https://forum.builder.io/u/Dhanashree)
#### Post date: [September 30, 2025, 6:32am UTC](https://forum.builder.io/t/how-to-filter-out-data-which-is-coming-from-data-model/15798/3 "2025-09-30T06:32:18Z")

</div>

Thanks ! @manish-sharma  
There any other solution using [builder.io](http://builder.io) functionality without using code ?

---

<div class="post-metadata">

### Author: ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)
#### Post date: [October 1, 2025, 12:10pm UTC](https://forum.builder.io/t/how-to-filter-out-data-which-is-coming-from-data-model/15798/4 "2025-10-01T12:10:40Z")

</div>

Hello @Dhanashree

Yes! You can use the **Connected Data Filter** option to filter your data directly in Builder. Here’s a Loom that demonstrates how to use the Builder editor to filter data without writing any code:

https://www.loom.com/embed/72efdc75767f49298a287dbcce4c0dfa?sid=9d6ca3de-289b-48aa-952d-e0fe2af47ce1

Additionally, you can also use **AI prompts** to connect your testimonial data and filter it based on your requirements. This approach works seamlessly as well.

For more details on connecting and filtering data, check out the documentation here:

> **[Connect Data](https://www.builder.io/c/docs/data-binding-connect-data)**
>
> Once you can access data from within Builder, connect your data to a Page or Section using the Data tab. You can connect one entry or multiple.

> **[Custom Code in the Visual Editor](https://www.builder.io/c/docs/custom-code)**
>
> Add custom JavaScript and CSS to your Builder content. Learn how to access browser events, state properties, and add custom CSS to your pages.

> **[Building Interactivity Using State and Actions](https://www.builder.io/c/docs/data-binding-state-and-actions)**
>
> Making interactive content in Builder.io with state and actions. Watch the 5-minute video walkthrough and get started.
