How to calculate total count of a database query, using list items for the search query?
I have a list item which is populated from a database collection.
I would like to query another collection in the database, with each of the list items as search terms, and then generate the total number of results generated for each list item.
For e.g.
List shown on page (generated from column in collection 1 of database):
Ford
Honda
Toyota
Mercedes
Collection 2 of database contains:
Column 1: Car Type; Column 2: Number plate
Ford: abc123
Ford: hgd973
Mercedes: hdk907
Ford: dsd976
Toyota:
I would like to show in the list on the page, next to each car type, the total number of number plates for each matching car from collection 2 of the database.
So,
Ford - 3
Honda - 0
Toyota - 0 (had a blank entry for number plate)
Mercedes - 1
I am having difficulty with being able to query the items from the list array into the 'where' section of the request component of the query service, and also returning the total count.
Your help is greatly appreciated.