Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
CoreData and binding a TableColumn to values from another Entity
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Corben" data-source="post: 1565903" data-attributes="member: 320285"><p>Hello mac-forums Community!</p><p></p><p>I have created 3 entities:</p><p>A <-->> B <<--> C, C has a BOOLEAN atribute.</p><p></p><p>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.</p><p></p><p>For example:</p><p></p><p>An Object from type A (called a) owns 3 Objects from Type B (called b1, b2, b3).</p><p>Each of these 3 Objects owns 1 Object from Type C (called c1, c2, c3).</p><p>If the boolean Attribute of one of these Objects (c1, c2, c3) is TRUE, the boolean in the 2nd column have to be true.</p><p></p><p>I have tried something like that (with a custom ArrayController Class):</p><p></p><p>[CODE]</p><p>[NSTableColumn bind:@"value" toObject:self withKeyPath:@"arrangedObjects.b.@sum.c.boolValue" options:nil];</p><p>[/CODE]</p><p>The ArrayController self is in Entity Name mode with Entity Name: A.</p><p></p><p>but an error occurred:</p><p>[CODE]</p><p>[__NSSetI decimalValue]: unrecognized selector sent to instance</p><p>[/CODE]</p><p></p><p>without the @sum collector, the Content is like that:</p><p>[CODE]</p><p>NSLog(@"%@", [self valueForKeyPath:@"arrangedObjects.b.c.bool"]);</p><p></p><p>Output:</p><p>2014-02-05 15:57:46.747 Cocktail DB[10943:303]</p><p>(</p><p> "{(\n)}",</p><p> "{(\n 0,\n 1\n)}",</p><p> "{(\n 1\n)}"</p><p>)</p><p>[/CODE]</p><p>in this Example:</p><p></p><p>a1 owns no objects from type b</p><p></p><p>a2</p><p style="margin-left: 20px">-b1 - c3 (boolvalue: 1)</p> <p style="margin-left: 20px">-b2 - c2 (boolvalue: 0)</p> <p style="margin-left: 20px">-b3 - c1 (boolvalue: 1)</p><p>a3</p><p style="margin-left: 20px">-b4 - c1 (boolvalue: 1)</p><p></p><p><img src="/mac_images/images/smilies/Confused.png" class="smilie" loading="lazy" alt=":Confused:" title="Confused :Confused:" data-shortname=":Confused:" /></p></blockquote><p></p>
[QUOTE="Corben, post: 1565903, member: 320285"] 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]; [/CODE] The ArrayController self is in Entity Name mode with Entity Name: A. but an error occurred: [CODE] [__NSSetI decimalValue]: unrecognized selector sent to instance [/CODE] 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)}" ) [/CODE] in this Example: a1 owns no objects from type b a2 [INDENT]-b1 - c3 (boolvalue: 1) -b2 - c2 (boolvalue: 0) -b3 - c1 (boolvalue: 1)[/INDENT] a3 [INDENT]-b4 - c1 (boolvalue: 1)[/INDENT] :Confused: [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
CoreData and binding a TableColumn to values from another Entity
Top