Re: Key Paths @count and mutablestrings
Re: Key Paths @count and mutablestrings
- Subject: Re: Key Paths @count and mutablestrings
- From: Amy Heavey <email@hidden>
- Date: Tue, 4 Nov 2008 17:51:21 +0000
On 4 Nov 2008, at 17:32, Benjamin Stiglitz wrote:
On Mon, Nov 03, 2008 at 06:55:24PM +0000, Amy Heavey wrote:
…
How do I access the count of a to-many relationship?
You’ve got that backwards; you want “products.@count”.
Fantastic! Thank You,
Do you mean print out on a printer, or just display on the screen?
I'll be displaying it in a view so it can be saved to PDF.
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?
I’m not really clear what you’re doing here. You’ll want to go through
your array controller’s arrangedObjects accessor to get the values,
and
then pull out the keys on your own.
Is there an easy way to access the existing Array Controller from the
code? I have a suitable Array Controller called Purchase Order Items
Array Controller in IB, but I don't see a way to reference this in
the code. The Array Controller is bound to the selection of another
Array Controller.
At the moment I'm doing all the work again using a fetch request (not
that I've got it working yet) to create an array, then looping
through the array to pull out the data,
Ideally I'd like to be able to loop through the Purchase Order Items
Array Controller arrangedObjects, and then set strings like
for each (object in Purchase Order Items Array Controller ){
qtyString = [[Purchase Order Items Array Controller arrangedObjects]
valueForKey:@"qty"];
.......
}
(where qty is an attributes of the PurchaseOrderItems Entity
but i don't think it works like that!
-Ben
Thanks for all your help though,
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