# Multiple CMS Results Count elements for the same list

**URL:** <https://forum.finsweet.com/t/multiple-cms-results-count-elements-for-the-same-list/1001>\
**Category:** Attributes\
**Created:** [June 8, 2023, 12:01pm UTC](https://forum.finsweet.com/t/multiple-cms-results-count-elements-for-the-same-list/1001 "2023-06-08T12:01:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Lampert](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/simon_lampert/32/599_2.png) [@Simon\_Lampert](https://forum.finsweet.com/u/Simon_Lampert)\
**Post date:** [June 8, 2023, 12:01pm UTC](https://forum.finsweet.com/t/multiple-cms-results-count-elements-for-the-same-list/1001/1 "2023-06-08T12:01:39Z")

</div>

I am building a complex filtering system for a client that requires multiple fs-cmsfilter-element=“results-count” elements on the same page for the same collection list.

Currently there is only 1 of my 3 elements that shows the correct number, the other 2 don’t work, meaning their number is just static.

It would be awesome if you could help me out on this 🙂

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![Support-Luis](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/support-luis/32/53_2.png) [@Support-Luis](https://forum.finsweet.com/u/Support-Luis)\
**Post date:** [June 8, 2023, 3:35pm UTC](https://forum.finsweet.com/t/multiple-cms-results-count-elements-for-the-same-list/1001/2 "2023-06-08T15:35:06Z")

</div>

Hey @Simon_Lampert! Can you please share your links?

---

<div class="post-metadata">

**Author:** ![Simon\_Lampert](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/simon_lampert/32/599_2.png) [@Simon\_Lampert](https://forum.finsweet.com/u/Simon_Lampert)\
**Post date:** [June 10, 2023, 3:00pm UTC](https://forum.finsweet.com/t/multiple-cms-results-count-elements-for-the-same-list/1001/3 "2023-06-10T15:00:05Z")

</div>

Hey Luis, thank you for getting back to me.

I sent you the preview link in a private message since it shouldn’t be visible to the public 🙂

---

<div class="post-metadata">

**Author:** ![Taabish](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/taabish/32/2759_2.png) [@Taabish](https://forum.finsweet.com/u/Taabish)\
**Post date:** [August 14, 2023, 5:06am UTC](https://forum.finsweet.com/t/multiple-cms-results-count-elements-for-the-same-list/1001/4 "2023-08-14T05:06:58Z")

</div>

Can anyone share solution here?

---

<div class="post-metadata">

**Author:** ![Support-Luis](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/support-luis/32/53_2.png) [@Support-Luis](https://forum.finsweet.com/u/Support-Luis)\
**Post date:** [August 14, 2023, 6:09pm UTC](https://forum.finsweet.com/t/multiple-cms-results-count-elements-for-the-same-list/1001/5 "2023-08-14T18:09:53Z")

</div>

hey @Taabish! Sure!

For several result counts for one filter instance, you can try using something like this code that retrieves the results from the CMS Filter API instead of the `fs-cmsfilter-element = results-count`

```auto
<script>
      window.fsAttributes = window.fsAttributes || [];
      window.fsAttributes.push([
        'cmsfilter',
        (filterInstances) => {
          console.log('cmsfilter Successfully loaded!');

          // The callback passes a `filterInstances` array with all the `CMSFilters` instances on the page.
          const [filterInstance] = filterInstances;

          let filterResult = filterInstance.resultsElement.innerHTML;

          const resultsNumber = document.querySelectorAll('.results-text'); // This is the class for all your result count text elements
          resultsNumber.forEach((result) => {
            result.innerHTML = filterResult;
          });

          // The `renderitems` event runs whenever the list renders items after filtering.
          filterInstance.listInstance.on('renderitems', (renderedItems) => {
            filterResult = filterInstance.resultsElement.innerHTML;
            resultsNumber.forEach((result) => {
              result.innerHTML = filterResult;
            });
          });
        },
      ]);
    </script>

```

---

<div class="post-metadata">

**Author:** ![Taabish](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/taabish/32/2759_2.png) [@Taabish](https://forum.finsweet.com/u/Taabish)\
**Post date:** [August 17, 2023, 10:36am UTC](https://forum.finsweet.com/t/multiple-cms-results-count-elements-for-the-same-list/1001/6 "2023-08-17T10:36:48Z")

</div>

Thank you @Support-Luis for this code,

Can we show results counts for each category results ?

For example - Category A has 5 results, Category B has 4, and so on.

Refer attached image for understanding

 ![Screenshot 2023-08-17 at 4.05.40 PM](https://europe1.discourse-cdn.com/flex013/uploads/finsweet1/original/2X/4/4d4ce4cf0750f1cc770565844588bb1a79c34d4d.png)

---

<div class="post-metadata">

**Author:** ![Support-Luis](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/support-luis/32/53_2.png) [@Support-Luis](https://forum.finsweet.com/u/Support-Luis)\
**Post date:** [August 17, 2023, 5:17pm UTC](https://forum.finsweet.com/t/multiple-cms-results-count-elements-for-the-same-list/1001/7 "2023-08-17T17:17:33Z")

</div>

Hey @Taabish! This should handle the results count for each category. Can you share your page if this does not work on your end?
