# Filtering records in related data view

**URL:** <https://community.forestadmin.com/t/filtering-records-in-related-data-view/946>\
**Category:** Help me!\
**Created:** [September 11, 2020, 9:29am UTC](https://community.forestadmin.com/t/filtering-records-in-related-data-view/946 "2020-09-11T09:29:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karlis\_Lauva](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/karlis_lauva/32/762_2.png) [@Karlis\_Lauva](https://community.forestadmin.com/u/Karlis_Lauva)\
**Post date:** [September 11, 2020, 9:29am UTC](https://community.forestadmin.com/t/filtering-records-in-related-data-view/946/1 "2020-09-11T09:29:20Z")

</div>

Hi Forest Admin team,

Is it possible to exclude entries from related data views?

Use-case: I have a user & a team models and `User.belongsTo(team)` and `. When users are deleted, only a deletion timestamp is set & the record is not deleted from SQL database.

Is it possible to filter associated records, so that only undeleted users appear in team’s related data (and vice versa)? I could not find anything helpful pointers in sequelize’s docs about this.

---

<div class="post-metadata">

**Author:** ![anon62739609](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anon62739609](https://community.forestadmin.com/u/anon62739609)\
**Post date:** [September 11, 2020, 9:41am UTC](https://community.forestadmin.com/t/filtering-records-in-related-data-view/946/2 "2020-09-11T09:41:48Z")

</div>

Hi @Karlis_Lauva and welcome in our community 👋 !

If you want to never show deleted user you might want to check [that](https://sequelize.org/master/manual/paranoid.html).  
So what you should do in your model is:

```javascript
const User = sequelize.define('user', {
  // Your attributes here
}, {
  paranoid: true,
  deletedAt: 'myTimeStampOfDeletion'
});

```

And it should remove all deleted users for all teams !

If you want to remove it only for a specific team, then I strongly suggest you to use our [scope](https://docs.forestadmin.com/documentation/reference-guide/scopes) feature. And on that scope you add a filter to make sure your `deletedAt` is `null` 😉

Hope this will help you 🙏 !
