Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Development and Darwin (http://www.mac-forums.com/forums/os-x-development-darwin/)
-   -   CoreData and binding a TableColumn to values from another Entity (http://www.mac-forums.com/forums/os-x-development-darwin/308394-coredata-binding-tablecolumn-values-another-entity.html)

Corben 02-05-2014 10:06 AM

CoreData and binding a TableColumn to values from another Entity
 
Hello mac-forums Community!

I have created 3 entities:
A <-->> B <<--> C, C has a BOOLEAN atribute.

Now I want do display, in a two 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):

Code:

[NSTableColumn bind:@"value" toObject:self withKeyPath:@"arrangedObjects.b.@sum.c.boolValue" options:nil];
The ArrayController self is in Entity Name mode with Entity Name: A.

but an error occurred:
Code:

[__NSSetI decimalValue]: unrecognized selector sent to instance
without the @sum collector, the Content is like that:
Code:

NSLog(@"%@", [self valueForKeyPath:@"arrangedObjects.b.c.bool"]);

Output:
2014-02-05 15:57:46.747 Cocktail DB[10943:303]
(
    "{(\n)}",
    "{(\n    0,\n    1\n)}",
    "{(\n    1\n)}"
)

in this Example:

a1 owns no objects from type b

a2
-b1 - c3 (boolvalue: 1)
-b2 - c2 (boolvalue: 0)
-b3 - c1 (boolvalue: 1)
a3
-b4 - c1 (boolvalue: 1)
:Confused:


All times are GMT -4. The time now is 05:28 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.