Key Paths @count and mutablestrings
Key Paths @count and mutablestrings
- Subject: Key Paths @count and mutablestrings
- From: Amy Heavey <email@hidden>
- Date: Mon, 3 Nov 2008 18:55:24 +0000
Hi,
I'm afraid I have a couple more questions :(
Key Paths Bindings
I've been quite sucessful in setting up my bindings using key paths,
but now I'm trying to use @count.
I have a table that displays a list of PurchaseOrders.
PurchaseOrder is an Entity, with a relationship called products to
the PurchaseOrderItems Entity which lists the actual items on the
order. I'd like a column in my Purchase Order tabel to display the
number of items in the order, so I've tried a number of different
things along the lines of
Value: bound to Purchase Order Array Controller
arrangedObjects
@count.products
but I get the following error:
2008-11-03 18:41:44.928 powizard[8498] [<NSManagedObject 0x654a70>
valueForUndefinedKey:]: this class is not key value coding-compliant
for the key @count.
If I use
Value: bound to Purchase Order Array Controller
arrangedObjects
orderReference
I get the orderReference correctly. OrderReference is an attribute of
the PurchaseOrder Entity.
How do I access the count of a to-many relationship?
Next Question...
I then want to print out some of this data, so I've created a view,
and got it all laid out, now I just need to populate it with the
data. I thought the easiest way would be to loop through the info and
display strings but I'm struggling a bit.
I figure I need 4 strings, 1 for each 'column' of the table I want,
then I can just create strings with new lines and it will lay itself
out correctly.
If I was binding a tablecolumn I would use the following binding:
arrangedObjects.qty[Purchase Order Items Array Controller
(NSArrayController)]
so how do I loop through the array, setting the string value each
time to create a string along the lines of @"1234/n3698/n3258/n4587/
n" where 1234, 3698, 3258 and 4587 are the qty values?
In this case, the content set of the Purchase Order Items Array
Controller are bound to selection.products [Purchase Order Array
Controller]
I'd appreciate any help,
Many Thanks
Amy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden