Mac app with Core Data:
I have 3 entities:
A <-->> B <<--> C, C has a BOOLEAN atribute.
Now I want do display, in a 2 Column Table, the name of A (1st column) and a boolean value (2nd column) which based on the boolean values from C.
For example:
An Object from type A (called a) owns 3 Objects from Type B (called b1, b2, b3).
Each of these 3 Objects owns 1 Object from Type C (called c1, c2, c3).
If the boolean Attribute of one of these Objects (c1, c2, c3) is TRUE, the boolean in the 2nd column have to be true.
I have tried something like that (with a custom ArrayController Class):
[NSTableColumn bind:@"value" toObject:self withKeyPath:@"arrangedObjects.bc@sum.boolValue" options:nil];
The ArrayController self is in Entity Name mode with Entity Name: A.
Are you sure @sum should be after c? There are 3 objects of type b for each a right? so, "b" is the collection in your case.
From the KVC Guide :
Simple Collection Operators
Simple collection operators operate on the properties to the right of the operator in either an array or set.
And:
@sum
The @sum operator returns the sum of the values of the property specified by the key path to the right of the operator. Each number is converted to a double, the sum of the values is computed, and the total is wrapped as an instance of NSNumber and returned.
Have you tried:
@"arrangedObjects.b.@sum.c.boolValue"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.