2 Replies Latest reply on Jul 11, 2011 10:54 PM by generaldelivery

    Model | Expression Builder | sizeOf() the right direction?

    generaldelivery Level 1

      Hello. I'm working towards building an array that consists of fruitName and fruitType count.  Basically the array will be something like


      [0] = Oranges, <some number>

      [1] = Apples, <some number>


      this array will server as a dataProvider for a Fruit Orders PieChart.  (Answers the question, Of all the orders, how many were Apples? Oranges?)


      I'm working with the Model's expression builder and could use some advice. I have an entity called "FruitOrders".  FruitOrders contain a property called "fruitType" which is either "Apple" or "Orange".    This entity and property have a corresponding db table and field.


      Is it possible to determine the number of Fruit Orders there are for each fruitType utilizing expression builder? What I'm looking for is a count. 
      I can get the total number of orders by using sizeOf() from another entity that has a relationship with FruitOrders, but I need this number broken down by fruitType. Any ideas?  Thanks, Nathan


      (I'm working the filter angle as well.    I know I can filter and on the client side dump it all into an array and loop through it with a set of conditions but I'm hoping to nail it down in the model. - Thanks )