get count REST api sugarcrm with query of relationship field

Hi All ,

here i am not sure which method to use

i have one module called as inventory with following fields

product id , description , status and product (many to one relationship with product module)

and in product module

now i have 4 products camera , mobile , laptop and watch etc …

so in inventory module i have 400-500 records of different product

i want to fetch count of record in inventory based on product type ( which is relationship field )

for example : 80 records of inventory of product type camera

i am not sure which rest method to use fetch number of count of particular module with where

case of relationship field

can some one guide me on this ??? please ???

i found the alternative solution

get count from module with query of relationship field

but can some one guide me like which way is the best creating own method or just create a 2 fields for this

or

with out creating a custom field is is there a way to get a count from a module where in query the where clause condition will be relation ship field using methods

:huh: