# Get Category by FieldTemplateSystemId

**URL:** <https://forum.litium.com/t/get-category-by-fieldtemplatesystemid/2625>\
**Category:** Questions\
**Created:** [June 21, 2022, 2:15pm UTC](https://forum.litium.com/t/get-category-by-fieldtemplatesystemid/2625 "2022-06-21T14:15:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anton.marklars](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@anton.marklars](https://forum.litium.com/u/anton.marklars)\
**Post date:** [June 21, 2022, 2:15pm UTC](https://forum.litium.com/t/get-category-by-fieldtemplatesystemid/2625/1 "2022-06-21T14:15:03Z")

</div>

Is it possible to retrieve all categories of a certain fieldtemplatesystemid? I have created a secondary categoryFieldTemplate that is used for another purpose than the regular category and want to get the complete list of entities with this field template.

Tried to achieve it using DataService, but FieldTemplateSystemId doesn’t appear to be queryable for Category.

Litium version: 7.7.9

---

<div class="post-metadata">

**Author:** ![Ericsj11](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ericsj11/32/899_2.png) [@Ericsj11](https://forum.litium.com/u/Ericsj11)\
**Post date:** [June 21, 2022, 2:33pm UTC](https://forum.litium.com/t/get-category-by-fieldtemplatesystemid/2625/2 "2022-06-21T14:33:02Z")

</div>

You could get all categories with dataservice and then filter them on the FieldTemplateSystemId when you have them all. Should not take noticable longer then finding the correct once inside the dataservice.

---

<div class="post-metadata">

**Author:** ![Ericsj11](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ericsj11/32/899_2.png) [@Ericsj11](https://forum.litium.com/u/Ericsj11)\
**Post date:** [June 21, 2022, 2:44pm UTC](https://forum.litium.com/t/get-category-by-fieldtemplatesystemid/2625/3 "2022-06-21T14:44:42Z")

</div>

I don’t know if you can make your own extensions for the category query. I have not tested this, but give this a try:

```auto
using (var db = _dataService.CreateQuery<Category>())
                {
                    categories = db.Filter(f => new TemplateQueryExpressionInfo()
                    {
                        SystemId = Guid.Empty,
                        OperatorName = "eq"
                    }).ToList();
                }

```

---

<div class="post-metadata">

**Author:** ![anton.marklars](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@anton.marklars](https://forum.litium.com/u/anton.marklars)\
**Post date:** [June 22, 2022, 7:58am UTC](https://forum.litium.com/t/get-category-by-fieldtemplatesystemid/2625/4 "2022-06-22T07:58:31Z")

</div>

Worked fine, thanks!

---

<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:** [July 20, 2022, 7:59am UTC](https://forum.litium.com/t/get-category-by-fieldtemplatesystemid/2625/5 "2022-07-20T07:59:01Z")

</div>

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