# Countingthe amount of pages with a multiselect field selected

**URL:** <https://forum.getkirby.com/t/countingthe-amount-of-pages-with-a-multiselect-field-selected/27374>\
**Category:** Questions\
**Tags:** v3\
**Created:** [December 25, 2022, 6:52pm UTC](https://forum.getkirby.com/t/countingthe-amount-of-pages-with-a-multiselect-field-selected/27374 "2022-12-25T18:52:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiahr](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/kiahr/32/7169_2.png) [@kiahr](https://forum.getkirby.com/u/kiahr)\
**Post date:** [December 25, 2022, 6:52pm UTC](https://forum.getkirby.com/t/countingthe-amount-of-pages-with-a-multiselect-field-selected/27374/1 "2022-12-25T18:52:43Z")

</div>

Happy holidays to everyone… just a quick question for anybody once you’re back at work 🙂

I am trying to `count()` the amount of pages with a multiselect field.

In this case, the multiselct field is **artworkType**.

```auto
<?php
if($page->artworkType()->isNotEmpty()):
$siblings = $page->siblings()->listed();
$types = $siblings->pluck('artworkType', ',', true);
foreach($page->artworkType()->split() as $artworkType): ?>

<div>
 There are <?= $siblings->filterBy('types', $artworkType, ',')->count() ?> <?= $artworkType ?> in the database.
</div>

<?php endforeach ?>
<?php endif ?>

```

I am only getting **0** as the count number. ☹

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [December 25, 2022, 8:09pm UTC](https://forum.getkirby.com/t/countingthe-amount-of-pages-with-a-multiselect-field-selected/27374/2 "2022-12-25T20:09:43Z")

</div>

> [@kiahr](#):
>
> `$types = $siblings->pluck('artworkType', ',', true);`

What for this line?

> [@kiahr](#):
>
> `->filterBy('types', $artworkType, ',')`

Not sure but I guess, should be `artworkType` instead of `types`, like that:

```php
->filterBy('artworkType', $artworkType, ',')
```

---

<div class="post-metadata">

**Author:** ![kiahr](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/kiahr/32/7169_2.png) [@kiahr](https://forum.getkirby.com/u/kiahr)\
**Post date:** [December 25, 2022, 8:18pm UTC](https://forum.getkirby.com/t/countingthe-amount-of-pages-with-a-multiselect-field-selected/27374/3 "2022-12-25T20:18:14Z")

</div>

Thanks a lot @ahmetbora, that solved it 🙂
