views:

6

answers:

0

Using the Employees-Departments example what I want to do is bind a column to "[email protected]" as outlined below:

Entity Employee

  • attributes: "firstName", "lastName", "hoursWorked"
  • relationship: "departments"

Entity Department

  • attributes: "name"
  • relationship: "employees"

I want a table which will display some summary info about departments.

I bind the first column to my "Departments" array controller, "arrangedObjects.name". I can have a column displaying the number of employees in a department by binding to "arrangedObjects.employees.@count"

However I can't get a sum of the hoursWorked by employees as I assume I might by binding to "[email protected]"

The error I get is along the lines of "[<_NSFaultingMutableSet 0x1acea0> addObserver:forKeyPath:options:context:] is not supported. Key path: @sum.hoursWorked"

I believe this is because it is not possible to bind to the many end of a to-many relationship. If so how can I do what I want to do?

For extra credit, say each employee also has another attribute, "race", I would also like my summaries table to show the number of unique races in each department.

Thanks in advance.

related questions