Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
Hi,
Is it possible to count the number of times a field value appears across pages?
For example, if I have a clonable template called Employees, and I have the fields: location, salary, age, designation, and I want to know the number of times designation CEO appears across all the pages, how would I do that?

Thank you
Well, if you can filter such pages (following docs of pages tag) then you should be able to count them.
Thanks trendoman for the response, however I still do not know how to do it.
Could you please give me an example so I can have an idea where to start?
Like in the example i had given earlier, if I have several pages where the designation is CEO, I need to count the number of times CEO appears in all the pages.

Many thanks
No problem,
I found the way to do it.
Code: Select all
<ul>
   <cms:pages masterpage='employees.php' custom_field='designation=CEO' limit='1' order='asc'>
      
      <li><cms:show program/> <cms:show k_total_records/></li>
   
   </cms:pages>
   <cms:pages masterpage='employees.php' custom_field='designation=Secretary' limit='1' order='asc'>
      
      <li><cms:show program/> <cms:show k_total_records/></li>
   
   </cms:pages>
</ul>

Thank you for pointing me in the right direction!
4 posts Page 1 of 1