Counting quantity of active fields


#1

Hey there,

I’m having a list and also using this custom country select field: https://github.com/iksi/kirby-country-field
At some point I want to show the following message:

You can actually find ___ publishers from _____ different countries.

I did to count the total of projects on the folder but I want to show the countries used at the moment (ex. 20) somehow.
There’s any way to do that with the $count parameter as well?

I hope I’ve clarified this.
Thanks in advance!


#2

You can do it like this:

$noOfCountries = count(page('projects')->children()->pluck('fieldname-of-select-field', ',', true));

#3

Thanks a lot. It worked!


#4

11 posts were split to a new topic: Sorting projects by different categories on button click