Re: Access NSDictionary-Keys in Repetition
Re: Access NSDictionary-Keys in Repetition
- Subject: Re: Access NSDictionary-Keys in Repetition
- From: Nathan Dumar <email@hidden>
- Date: Tue, 10 Aug 2004 11:40:07 -0400
Here's another possibility:
I did the following to display an array of arrays, so I would try the
same technique for an array of dictionaries ...
If you're talking about a WORepetition, then the item attribute should
be bound to an object that is the same type as what's in the array. In
your case, the object would be an NSDictionary object.
That leaves you with a WORepetition (called WORep1 for this example) of
NSDictionaries. In WOBuilder, the available attributes of an
NSDictionary are allKeys, allValues, and count.
You can then make two more WORepetitions (WORep2 and WORep3), inside
WORep1. In WORep2 you bind allKeys to the list and make an object of
type string for the item (assuming you want the keys displayed). In
WORep3, bind allValues to the list, and for the item object, use a type
that can handle any type of object occurring in your dictionary
(EOGenericObject?). If you put them both in a two-column table, then
they will iterate next to each other, making the results line up.
The final result is a that all of the dictionary entries in all of the
dictionaries are displayed.
Of course, you could do some or all of the above in code without too
much effort, and have better control over what is in your data set, and
in what order.
Nathan
On Aug 10, 2004, at 10:16 AM, Ute Hoffmann wrote:
Hallo,
this is probably a very basic question, but nevertheless I'm stuck....
I have a number of NSDictionaries, all with identical keys, all
inserted in a NSMutableArray.
How can I access those values in a repetition? The Array could be
bound to the repetition list key, but what should I bind to the
Repetition item key to get access to the values? If I bind it to a
variable of type object it will know nothing about the keys contained.
I could write a class with the keys in, but is there no way to do it
with less code?
Thanks,
Ute
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.