# Get orders that does not include tag

**URL:** <https://forum.litium.com/t/get-orders-that-does-not-include-tag/2743>\
**Category:** Questions\
**Tags:** litium-8\
**Created:** [October 26, 2022, 6:08pm UTC](https://forum.litium.com/t/get-orders-that-does-not-include-tag/2743 "2022-10-26T18:08:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![totte.perera](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@totte.perera](https://forum.litium.com/u/totte.perera)\
**Post date:** [October 26, 2022, 6:08pm UTC](https://forum.litium.com/t/get-orders-that-does-not-include-tag/2743/1 "2022-10-26T18:08:50Z")

</div>

How do I get all orders that do not include a specific tag using data service?

Litium version: 8.5

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [October 27, 2022, 11:46am UTC](https://forum.litium.com/t/get-orders-that-does-not-include-tag/2743/2 "2022-10-27T11:46:23Z")

</div>

You can try to use the `MustNot` to reverse the condition, see [Data service (litium.com)](https://docs.litium.com/documentation/previous-versions/litium-7/architecture/data-service)

---

<div class="post-metadata">

**Author:** ![totte.perera](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@totte.perera](https://forum.litium.com/u/totte.perera)\
**Post date:** [October 27, 2022, 6:36pm UTC](https://forum.litium.com/t/get-orders-that-does-not-include-tag/2743/3 "2022-10-27T18:36:44Z")

</div>

This is the code I tried. But I got help from @utku and I believed he has reported a bug for it not working. And he told me to query the “Order” object meanwhile.

```
private static void OrdersNotTaggedWith(FilterDescriptor<SalesOrder> filterDescriptor, string tag)
{
    filterDescriptor.Bool(b => b.MustNot(mustNot => mustNot.Tag(tag)));
}

```

Edit: Correction, he said to create the tags with the Order object instread of SalesOrder object so:

Change this:  
`_taggingService.Add<SalesOrder>(order.SystemId, "MyTag");`

To this:  
`_taggingService.Add<Order>(order.SystemId, "MyTag");`

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [November 24, 2022, 6:37pm UTC](https://forum.litium.com/t/get-orders-that-does-not-include-tag/2743/4 "2022-11-24T18:37:37Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
