count records in a collection
How can I count the records in an unrelated entity (Meters table) that match certain criteria. Then compare the count with another fixed number. If count is greater than the fixed number it must throw a validation error. I have been playing around all day, but not working. What am I doing wrong? I dont need to create a new collection or array of values, just check the count. Thank you.