# Can we add initial filter to segments

**URL:** <https://community.forestadmin.com/t/can-we-add-initial-filter-to-segments/7399>\
**Category:** Help me!\
**Created:** [August 20, 2024, 9:30am UTC](https://community.forestadmin.com/t/can-we-add-initial-filter-to-segments/7399 "2024-08-20T09:30:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hassan\_Kourani](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/hassan_kourani/32/7213_2.png) [@Hassan\_Kourani](https://community.forestadmin.com/u/Hassan_Kourani)\
**Post date:** [August 20, 2024, 9:30am UTC](https://community.forestadmin.com/t/can-we-add-initial-filter-to-segments/7399/1 "2024-08-20T09:30:37Z")

</div>

is there a way to create a segment with that starts with an initial filter

### Example

I have a segment the show orders i want when the user clicks on the segment is loads with an initial filter which the user can clear if they want

### Code

```javascript

export const ordersNotInvoicedSegment = (app: INestApplication, collection: CollectionCustomizer<Schema, 'orders'>) => {
  const orderService: OrderService = app.get<OrderService>(OrderService, { strict: false })

  collection.addSegment('Orders Not Invoiced', async (context) => {
    const ordersNotInvoiced = await orderService.getOrdersNotInvoiced()

    return { field: 'id', operator: 'In', value: ordersNotInvoiced.map((r) => r.id) }
  })
}

```

is possible to add the filter when use clicks on the segment?

---

<div class="post-metadata">

**Author:** ![anon7284711](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@anon7284711](https://community.forestadmin.com/u/anon7284711)\
**Post date:** [August 20, 2024, 9:34am UTC](https://community.forestadmin.com/t/can-we-add-initial-filter-to-segments/7399/2 "2024-08-20T09:34:12Z")

</div>

Hello @Hassan_Kourani

I’m not sure to understand what you’re trying to achieve ?

Could you not simply create multiple segments on your collection ? The base collection would still be accessible for the user to create his own filters if they wish.

If you are trying to limit what a user can see based on their team and whatnot you can use the feature [Scope](https://docs.forestadmin.com/user-guide/collections/scopes)

Best regards,
